summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorPrasanna Kumar Kalever <prasanna.kalever@redhat.com>2015-05-17 00:26:06 +0530
committerVenky Shankar <vshankar@redhat.com>2015-07-14 22:04:04 -0700
commit09530dfd822c8c3cc8da20a4600b5d2aec1ebf9d (patch)
tree958d474aed66acc8a265365f7e4e55c64e2bc197 /xlators
parente4fa8568478279c1884c54b9a369655ffa559d4a (diff)
features/changelog: fix buffer overrun in changelog-helpers
changelog-helpers.c:1911:17: warning: Size argument is greater than the free space in the destination buffer strncat (result, pre_dir_name, PATH_MAX); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ changelog-helpers.c:1919:17: warning: Size argument is greater than the free space in the destination buffer strncat (result, bname, PATH_MAX); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Change-Id: I60ca7fe762f07cb72fe7b69f0253835becaff7b9 BUG: 1222238 Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com> Reviewed-on: http://review.gluster.org/10802 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Venky Shankar <vshankar@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/features/changelog/src/changelog-helpers.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/xlators/features/changelog/src/changelog-helpers.c b/xlators/features/changelog/src/changelog-helpers.c
index 4d7cb4785c7..a3a1289d792 100644
--- a/xlators/features/changelog/src/changelog-helpers.c
+++ b/xlators/features/changelog/src/changelog-helpers.c
@@ -1899,17 +1899,15 @@ resolve_pargfid_to_path (xlator_t *this, uuid_t pargfid,
&saveptr);
dir_name = strtok_r (NULL, "/", &saveptr);
- strncpy (result, dir_name, PATH_MAX);
- strncat (result, "/", 1);
- strncat (result, pre_dir_name, PATH_MAX);
- strncpy (pre_dir_name, result, PATH_MAX);
+ snprintf (result, PATH_MAX, "%s/%s", dir_name, pre_dir_name);
+ strncpy (pre_dir_name, result, sizeof(pre_dir_name));
gf_uuid_parse (pgfidstr, tmp_gfid);
gf_uuid_copy (pargfid, tmp_gfid);
}
if (bname)
- strncat (result, bname, PATH_MAX);
+ strncat (result, bname, strlen(bname) + 1);
*path = gf_strdup (result);