diff options
author | Guy Harris <guy@alum.mit.edu> | 2019-08-03 18:37:29 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2019-08-04 01:38:41 +0000 |
commit | ade3a6b658dd32a818a935d43c41407c22612834 (patch) | |
tree | 4ef92f6d5f6002be37155c0e112eb6ce7cb0494d /wiretap | |
parent | 8ae710dbdc9a4a6e35ca5d7359343a735c428d4a (diff) |
Set tm_isdst before calling mktime().
You either have to set it to 1 or 0 if you know whether it's shifted
time or set it to -1 if you don't.
Should address Coverity CID 1452227.
Change-Id: I7d435bb6b7dd8897b44bf5103578e3db1a30379e
Reviewed-on: https://code.wireshark.org/review/34175
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap')
-rw-r--r-- | wiretap/busmaster.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/wiretap/busmaster.c b/wiretap/busmaster.c index be0e96868a..60b7849715 100644 --- a/wiretap/busmaster.c +++ b/wiretap/busmaster.c @@ -127,12 +127,13 @@ busmaster_gen_packet(wtap_rec *rec, Buffer *buf, { struct tm tm; - tm.tm_year = priv_entry->start_date.year - 1900; - tm.tm_mon = priv_entry->start_date.month - 1; - tm.tm_mday = priv_entry->start_date.day; - tm.tm_hour = msg->timestamp.hours; - tm.tm_min = msg->timestamp.minutes; - tm.tm_sec = msg->timestamp.seconds; + tm.tm_year = priv_entry->start_date.year - 1900; + tm.tm_mon = priv_entry->start_date.month - 1; + tm.tm_mday = priv_entry->start_date.day; + tm.tm_hour = msg->timestamp.hours; + tm.tm_min = msg->timestamp.minutes; + tm.tm_sec = msg->timestamp.seconds; + tm.tm_isdst = -1; secs = mktime(&tm); nsecs = msg->timestamp.micros * 1000u; @@ -143,12 +144,13 @@ busmaster_gen_packet(wtap_rec *rec, Buffer *buf, struct tm tm; guint32 micros; - tm.tm_year = priv_entry->start_date.year - 1900; - tm.tm_mon = priv_entry->start_date.month - 1; - tm.tm_mday = priv_entry->start_date.day; - tm.tm_hour = priv_entry->start_time.hours; - tm.tm_min = priv_entry->start_time.minutes; - tm.tm_sec = priv_entry->start_time.seconds; + tm.tm_year = priv_entry->start_date.year - 1900; + tm.tm_mon = priv_entry->start_date.month - 1; + tm.tm_mday = priv_entry->start_date.day; + tm.tm_hour = priv_entry->start_time.hours; + tm.tm_min = priv_entry->start_time.minutes; + tm.tm_sec = priv_entry->start_time.seconds; + tm.tm_isdst = -1; secs = mktime(&tm); |