proto: fix get_time_value() for ENC_TIME_CLASSIC_MAC_OS_SECS

Times before 1970-01-01 should be represented as a negative number of
seconds in nstime_t.

e.g. MP4 creation_time of 0x00000000 (which appears frequently as the
default in mp4 files) was rendered as Feb 6, 2040 07:28:16 CET

Change-Id: I979aeeb8a625caad3dfbce114cff6f9967d59d6e
Reviewed-on: https://code.wireshark.org/review/35904
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Jakub Adam 2020-01-22 12:57:24 +01:00 committed by Anders Broman
parent a4cb1c3234
commit 732aa60098
1 changed files with 2 additions and 2 deletions

View File

@ -2354,11 +2354,11 @@ get_time_value(proto_tree *tree, tvbuff_t *tvb, const gint start,
if (length == 8) {
tmp64secs = tvb_get_ntoh64(tvb, start);
time_stamp->secs = (time_t)(tmp64secs - EPOCH_DELTA_1904_01_01_00_00_00_UTC);
time_stamp->secs = (time_t)(gint64)(tmp64secs - EPOCH_DELTA_1904_01_01_00_00_00_UTC);
time_stamp->nsecs = 0;
} else if (length == 4) {
tmpsecs = tvb_get_ntohl(tvb, start);
time_stamp->secs = (time_t)(tmpsecs - EPOCH_DELTA_1904_01_01_00_00_00_UTC);
time_stamp->secs = (time_t)(gint32)(tmpsecs - EPOCH_DELTA_1904_01_01_00_00_00_UTC);
time_stamp->nsecs = 0;
} else {
time_stamp->secs = 0;