summaryrefslogtreecommitdiffstats
path: root/xlators/features/changelog
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2014-10-27 10:28:55 +0100
committerVenky Shankar <vshankar@redhat.com>2014-10-28 02:09:37 -0700
commit4d3c6d93d1c75696987f262cf5a304b3038bc585 (patch)
treefa44f543d6ed073af67d53574f85c24b8cf1eadc /xlators/features/changelog
parentc35135c8da3542f377dcb22d121d255eb796a819 (diff)
changelog: replace MAKE_HTIME_FILE_PATH with snprintf()
The used once MAKE_HTIME_FILE_PATH macro uses strcpy and strcat into a fixed buffer without checking the input lengths. Recommend replacing with a snprintf. Change-Id: Ia0245096774dc84be1b937e1d5750f3634fff034 BUG: 1099645 Reported-by: Keith Schincke <kschinck@redhat.com> Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/8977 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Venky Shankar <vshankar@redhat.com> Tested-by: Venky Shankar <vshankar@redhat.com>
Diffstat (limited to 'xlators/features/changelog')
-rw-r--r--xlators/features/changelog/lib/src/gf-history-changelog.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/xlators/features/changelog/lib/src/gf-history-changelog.c b/xlators/features/changelog/lib/src/gf-history-changelog.c
index e7f08b6d663..8a527dd6e4b 100644
--- a/xlators/features/changelog/lib/src/gf-history-changelog.c
+++ b/xlators/features/changelog/lib/src/gf-history-changelog.c
@@ -651,12 +651,6 @@ out:
* Returns -1 on failure(error).
*/
-#define MAKE_HTIME_FILE_PATH(htime_file, htime_dir, htime_bname) do { \
- strcpy (htime_file, htime_dir); \
- strcat (htime_file, "/"); \
- strcat (htime_file, htime_bname); \
- } while (0)
-
/**
* Extract timestamp range from a historical metadata file
* Returns:
@@ -678,7 +672,7 @@ gf_changelog_extract_min_max (const char *dname, const char *htime_dir,
this = THIS;
- MAKE_HTIME_FILE_PATH (htime_file, htime_dir, dname);
+ snprintf (htime_file, PATH_MAX, "%s/%s", htime_dir, dname);
iter = (htime_file + strlen (htime_file) - TIMESTAMP_LENGTH);
sscanf (iter ,"%lu",min_ts);