summaryrefslogtreecommitdiffstats
path: root/xlators/features/changelog
diff options
context:
space:
mode:
authorKotresh HR <khiremat@redhat.com>2015-05-08 21:03:09 +0530
committerVijay Bellur <vbellur@redhat.com>2015-05-08 20:31:23 -0700
commitbbff9e1ef72e2eab63e5d7ecd5dfa36497b642ed (patch)
treef5897ac7c74067c897db680d78460c8fb34dcefc /xlators/features/changelog
parent77edf5f7f78d5a551526b0d9bef8e0c0a8f22c1c (diff)
features/changelog: Fix buffer overflow in snprintf
Change-Id: Ie7e7c6028c7bffe47e60a2e93827e0e8767a3d66 BUG: 1219894 Signed-off-by: Kotresh HR <khiremat@redhat.com> Reviewed-on: http://review.gluster.org/10687 Reviewed-by: Aravinda VK <avishwan@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System
Diffstat (limited to 'xlators/features/changelog')
-rw-r--r--xlators/features/changelog/src/changelog-helpers.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/xlators/features/changelog/src/changelog-helpers.c b/xlators/features/changelog/src/changelog-helpers.c
index bfe7a17a87e..a7d3e955fd2 100644
--- a/xlators/features/changelog/src/changelog-helpers.c
+++ b/xlators/features/changelog/src/changelog-helpers.c
@@ -690,13 +690,13 @@ int
htime_create (xlator_t *this,
changelog_priv_t *priv, unsigned long ts)
{
- int ht_file_fd = -1;
- int ht_dir_fd = -1;
- int ret = 0;
- char ht_dir_path[PATH_MAX] = {0,};
- char ht_file_path[PATH_MAX] = {0,};
- char ht_file_bname[NAME_MAX] = {0,};
- int flags = 0;
+ int ht_file_fd = -1;
+ int ht_dir_fd = -1;
+ int ret = 0;
+ char ht_dir_path[PATH_MAX] = {0,};
+ char ht_file_path[PATH_MAX] = {0,};
+ char ht_file_bname[NAME_MAX + 1] = {0,};
+ int flags = 0;
CHANGELOG_FILL_HTIME_DIR(priv->changelog_dir, ht_dir_path);
@@ -739,7 +739,7 @@ htime_create (xlator_t *this,
goto out;
}
- (void) snprintf (ht_file_bname, PATH_MAX, "%s.%lu",
+ (void) snprintf (ht_file_bname, sizeof (ht_file_bname), "%s.%lu",
HTIME_FILE_NAME, ts);
if (sys_fsetxattr (ht_dir_fd, HTIME_CURRENT, ht_file_bname,
strlen (ht_file_bname), 0)) {