summaryrefslogtreecommitdiffstats
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:59:53 -0700
commitbd4bdcd66504785b9e09b1de90e115fb2b47ab07 (patch)
treece7149de74d228af74dc0cec645a83b59e019280
parentc1cd4fa709ed3f997450d57c07238b4356a14607 (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/10767 Reviewed-by: Anand Nekkunti <anekkunt@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Tested-by: NetBSD Build System Reviewed-by: Niels de Vos <ndevos@redhat.com>
-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