diff options
author | Guy Harris <guy@alum.mit.edu> | 2011-11-16 17:08:00 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2011-11-16 17:08:00 +0000 |
commit | 163edbb5078de3b8cbaa3cce492709030a32e803 (patch) | |
tree | b1644cc38c86fa128e4a9eab6ac3fde4ec658a77 /wiretap/ngsniffer.c | |
parent | 5ceeb22529993c55ec5f85e3e4d559b0c30e7630 (diff) | |
download | wireshark-163edbb5078de3b8cbaa3cce492709030a32e803.tar.gz |
Another place where we have to protect against MSVC's time-conversion
routines blowing up if handed a too-large time_t.
While we're at it, also check for dates that can't be represented in DOS
format (pre-1980 dates).
svn path=/trunk/; revision=39883
Diffstat (limited to 'wiretap/ngsniffer.c')
-rw-r--r-- | wiretap/ngsniffer.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/wiretap/ngsniffer.c b/wiretap/ngsniffer.c index 1a2322d319..4dd2411772 100644 --- a/wiretap/ngsniffer.c +++ b/wiretap/ngsniffer.c @@ -2104,8 +2104,16 @@ ngsniffer_dump(wtap_dumper *wdh, const struct wtap_pkthdr *phdr, date. */ if (ngsniffer->first_frame) { ngsniffer->first_frame=FALSE; +#ifdef _MSC_VER + /* calling localtime() on MSVC 2005 with huge values causes it to crash */ + /* XXX - find the exact value that still does work */ + /* XXX - using _USE_32BIT_TIME_T might be another way to circumvent this problem */ + if (phdr->ts.secs > 2000000000) + tm = NULL; + else +#endif tm = localtime(&phdr->ts.secs); - if (tm != NULL) { + if (tm != NULL || tm->tm_year < 1980) { start_date = (tm->tm_year - (1980 - 1900)) << 9; start_date |= (tm->tm_mon + 1) << 5; start_date |= tm->tm_mday; |