diff options
author | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2018-08-09 22:05:05 +0200 |
---|---|---|
committer | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2018-08-10 23:22:21 +0200 |
commit | 1d881d77dfba3bc0040c5862caf3cf3a1d143639 (patch) | |
tree | 99b911ba0f7cf893fa94fd3ac74d7464542385a0 /util-print.c | |
parent | c6ca8a71712729501550714205ab9649b42422aa (diff) | |
download | tcpdump-1d881d77dfba3bc0040c5862caf3cf3a1d143639.tar.gz |
Report 32-bit timestamps with uppermost bit set as "Error converting time"
This is an update to packet header timestamps printing based on
Guy Harris's proposal.
Theses timestamps are outside the 1970-2038 range; This happens on some
fuzzed captures.
This will allow to have the same printing on Windows and UN*X.
Update needed before 2038.
Diffstat (limited to 'util-print.c')
-rw-r--r-- | util-print.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/util-print.c b/util-print.c index 026f3461..45da51f7 100644 --- a/util-print.c +++ b/util-print.c @@ -270,6 +270,11 @@ ts_date_hmsfrac_print(netdissect_options *ndo, int sec, int usec, struct tm *tm; char timestr[32]; + if ((unsigned)sec & 0x80000000) { + ND_PRINT("[Error converting time]"); + return; + } + if (time_flag == LOCAL_TIME) tm = localtime(&Time); else |