From bd4bdcd66504785b9e09b1de90e115fb2b47ab07 Mon Sep 17 00:00:00 2001 From: Gaurav Kumar Garg Date: Wed, 13 May 2015 15:21:29 +0530 Subject: 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 Reviewed-on: http://review.gluster.org/10767 Reviewed-by: Anand Nekkunti Tested-by: Gluster Build System Reviewed-by: Kaleb KEITHLEY Tested-by: NetBSD Build System Reviewed-by: Niels de Vos --- xlators/mgmt/glusterd/src/glusterd-quota.c | 3 +-- 1 file changed, 1 insertion(+), 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 -- cgit