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:54:38 -0700
commit77778274e60363ac4fbf604c74c3fb8075b70eff (patch)
tree05e382dcc173eb5686099138ee672e59f1bce340 /xlators/features/changelog
parenta327b9fa9d50a66e7bb3a887ac569be914132d10 (diff)
features/changelog: Fix buffer overflow in snprintf
BUG: 1219823 Change-Id: I3a1c7b7742671847ed3fec13e06d861c3d09f7a9 Reviewed-On: http://review.gluster.org/#/c/10687/ Signed-off-by: Kotresh HR <khiremat@redhat.com> Reviewed-on: http://review.gluster.org/10688 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Aravinda VK <avishwan@redhat.com>
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 bfe7a17..a7d3e95 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)) {