diff options
author | Guy Harris <guy@alum.mit.edu> | 2016-10-21 19:18:15 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2016-10-22 02:27:32 +0000 |
commit | 10ca4c7527122efde0300205deaa6c0143f07219 (patch) | |
tree | 5352128043afff3b586c4a314ab2d240aec36f6a /wsutil | |
parent | 49cf42c571f3f94632957371ccd99533e71764ff (diff) | |
download | wireshark-10ca4c7527122efde0300205deaa6c0143f07219.tar.gz |
More checks for localtime() and gmtime() returning NULL.
And some comments in the case where we're converting the result of
time() - if your machine's idea of time predates January 1, 1970,
00:00:00 UTC, it'll crash on Windows, but that's not a case where a
*file* can cause the problem due either to a bad file time stamp or bad
time stamps in the file.
Change-Id: I837a438e4b875dd8c4f3ec2137df7a16ee4e9498
Reviewed-on: https://code.wireshark.org/review/18369
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wsutil')
-rw-r--r-- | wsutil/tempfile.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/wsutil/tempfile.c b/wsutil/tempfile.c index 7391fbfc76..5900b2bb8a 100644 --- a/wsutil/tempfile.c +++ b/wsutil/tempfile.c @@ -204,6 +204,7 @@ create_tempfile(char **namebuf, const char *pfx, const char *sfx) _tzset(); #endif current_time = time(NULL); + /* We trust the OS not to return a time before the Epoch. */ strftime(timestr, sizeof(timestr), "%Y%m%d%H%M%S", localtime(¤t_time)); sep[0] = G_DIR_SEPARATOR; tmp_file = g_strconcat(tmp_dir, sep, safe_pfx, "_", timestr, "_", TMP_FILE_SUFFIX, sfx, NULL); |