From 4d3c6d93d1c75696987f262cf5a304b3038bc585 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Mon, 27 Oct 2014 10:28:55 +0100 Subject: 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 Signed-off-by: Niels de Vos Reviewed-on: http://review.gluster.org/8977 Tested-by: Gluster Build System Reviewed-by: Venky Shankar Tested-by: Venky Shankar --- xlators/features/changelog/lib/src/gf-history-changelog.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'xlators/features/changelog') 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); -- cgit