summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorSanju Rakonde <srakonde@redhat.com>2018-08-29 00:18:32 +0530
committerAtin Mukherjee <amukherj@redhat.com>2018-09-04 14:01:59 +0000
commit8612a1ca192333c2b760455661647d83bed2fd92 (patch)
tree238fbeab56fbfff4182583d89c9829197ba28876 /xlators
parent13298d2b3893edb5d147ea3bcb9902ee5be4b3ad (diff)
glusterd: Fix Buffer size issues
This patch fixes buffer size issue 1138522. Change-Id: Ia12fc8f34f75704f8ed3efae2022c4fd67a8c76c updates: bz#789278 Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/cluster/afr/src/afr-common.c6
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.h15
2 files changed, 12 insertions, 9 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index 0b1d4628c4e..702973a6ef4 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -6403,11 +6403,11 @@ afr_get_split_brain_status (void *opaque)
/* Calculation for string length :
* (child_count X length of child-name) + strlen (" Choices :")
* child-name consists of :
- * a) 256 = max characters for volname according to GD_VOLUME_NAME_MAX
+ * a) 251 = max characters for volname according to GD_VOLUME_NAME_MAX
* b) strlen ("-client-00,") assuming 16 replicas
*/
- choices = alloca0 (priv->child_count * (256 + strlen ("-client-00,")) +
- strlen (" Choices:"));
+ choices = alloca0 (priv->child_count * (251 + sizeof("-client-00,")) +
+ sizeof(" Choices:"));
ret = afr_is_split_brain (frame, this, inode, loc->gfid, &d_spb,
&m_spb);
diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h
index e0864c04148..71ac45cd241 100644
--- a/xlators/mgmt/glusterd/src/glusterd.h
+++ b/xlators/mgmt/glusterd/src/glusterd.h
@@ -221,7 +221,7 @@ typedef enum gf_brick_status {
} gf_brick_status_t;
struct glusterd_brickinfo {
- char hostname[1024];
+ char hostname[NAME_MAX];
char path[VALID_GLUSTERD_PATHMAX];
char real_path[VALID_GLUSTERD_PATHMAX];
char device_path[VALID_GLUSTERD_PATHMAX];
@@ -407,12 +407,15 @@ struct glusterd_volinfo_ {
the volume which is snapped. In
case of a non-snap volume, this
field will be initialized as N/A */
- char volname[GD_VOLUME_NAME_MAX + 5];
- /* An extra 5 bytes are allocated.
- * Reason is, As part of the tiering
+ char volname[NAME_MAX + 1];
+ /* NAME_MAX + 1 will be equal to
+ * GD_VOLUME_NAME_MAX + 5.(also to
+ * GD_VOLUME_NAME_MAX_TIER). An extra 5
+ * bytes are added to GD_VOLUME_NAME_MAX
+ * because, as part of the tiering
* volfile generation code, we are
- * temporarily appending either hot
- * or cold */
+ * temporarily appending either "-hot"
+ * or "-cold" */
int type;
int brick_count;
uint64_t snap_count;