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>
This commit is contained in:
parent
c35135c8da
commit
4d3c6d93d1
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user