From 33a5bc4772a222dc69d2b871e243e4f3ef349ea9 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Wed, 23 Jan 2002 08:35:17 +0000 Subject: [PATCH] From Hamish Moffatt: set the year to 1970 before parsing the date, in case there's no date specified. Set the day-of-month to 1, as well, and set the "is DST" flag to "not known", i.e. -1. svn path=/trunk/; revision=4602 --- text2pcap.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/text2pcap.c b/text2pcap.c index 3225aa20e0..46ec3673df 100644 --- a/text2pcap.c +++ b/text2pcap.c @@ -6,7 +6,7 @@ * * (c) Copyright 2001 Ashok Narayanan * - * $Id: text2pcap.c,v 1.10 2002/01/20 22:36:02 guy Exp $ + * $Id: text2pcap.c,v 1.11 2002/01/23 08:35:17 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -650,7 +650,19 @@ parse_preamble (void) * This should cover line breaks etc that get counted. */ if ( strlen(packet_preamble) > 2 ) { - memset(&timecode, '\0', sizeof timecode); + /* + * Initialize to the Epoch, just in case not all fields + * of the date and time are specified. + */ + timecode.tm_sec = 0; + timecode.tm_min = 0; + timecode.tm_hour = 0; + timecode.tm_mday = 1; + timecode.tm_mon = 0; + timecode.tm_year = 70; + timecode.tm_wday = 0; + timecode.tm_yday = 0; + timecode.tm_isdst = -1; /* Get Time leaving subseconds */ subsecs = strptime( packet_preamble, ts_fmt, &timecode );