diff options
author | Venky Shankar <venky@gluster.com> | 2011-08-17 15:19:05 +0530 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-08-17 21:01:38 -0700 |
commit | 2902b6f325d4bbb6cd947cee0301bf75d9634196 (patch) | |
tree | b0e0e5a3a077d3efc54a27d01c3f5329adf3554c /xlators | |
parent | 7d15ee5ee37384e40600306e3efbc037ff6f9e9b (diff) |
allocate extra bytes (for \0) when calling realloc
We use strcat to concat pathinfo strings. strcat appends a \0 at
the end. Therefore allocate extra bytes for the same to avoid
asserts being hit during gf_free call
Change-Id: I582f5858e7375a5bacfc5c702c612ee09c3bb355
BUG: 3413
Reviewed-on: http://review.gluster.com/249
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amar@gluster.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/cluster/dht/src/dht-common.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 3ccb89eccdd..db3b881b692 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -1720,7 +1720,8 @@ dht_pathinfo_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (local->pathinfo) { plen = strlen (local->pathinfo); if (plen) { - alloc_len += plen; + /* extra byte(s) for \0 to be safe */ + alloc_len += (plen + 2); local->pathinfo = GF_REALLOC (local->pathinfo, alloc_len); if (!local->pathinfo) |