summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorGaurav Kumar Garg <ggarg@redhat.com>2015-05-13 15:21:29 +0530
committerNiels de Vos <ndevos@redhat.com>2015-05-14 00:52:23 -0700
commitc56c3566feb9bed18fdec42e8e704ea185dce910 (patch)
treef1694a6c1463f5b10f4a8be40407bab496efc279 /xlators/mgmt
parent5e61673d6ebedaf5f9a4c9d1cb64f9df8e11db91 (diff)
quota/glusterd: on read call number of byte read should equal to buffer length
glusterd is crashing when user try to set limit-usage on quota. Because in the read call number of byte is going to be read is more then buffer lenght. Change-Id: Ie507eb68ebc0d0daa1012baef1bf724e202e3baa BUG: 1221025 Signed-off-by: Gaurav Kumar Garg <ggarg@redhat.com> Reviewed-on: http://review.gluster.org/10766 Reviewed-by: Anand Nekkunti <anekkunt@redhat.com> Reviewed-by: Atin Mukherjee <amukherj@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-quota.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-quota.c b/xlators/mgmt/glusterd/src/glusterd-quota.c
index adf6662afae..7176e683fd9 100644
--- a/xlators/mgmt/glusterd/src/glusterd-quota.c
+++ b/xlators/mgmt/glusterd/src/glusterd-quota.c
@@ -791,7 +791,6 @@ glusterd_store_quota_config (glusterd_volinfo_t *volinfo, char *path,
int ret = -1;
int fd = -1;
int conf_fd = -1;
- size_t entry_sz = 139264;
ssize_t bytes_read = 0;
size_t bytes_to_write = 0;
unsigned char buf[131072] = {0,};
@@ -869,7 +868,7 @@ glusterd_store_quota_config (glusterd_volinfo_t *volinfo, char *path,
type = GF_QUOTA_CONF_TYPE_USAGE;
for (;;) {
- bytes_read = read (conf_fd, (void*)&buf, entry_sz);
+ bytes_read = read (conf_fd, (void *)&buf, sizeof (buf));
if (bytes_read <= 0) {
/*The flag @is_first_read is TRUE when the loop is
* entered, and is set to false if the first read