aboutsummaryrefslogtreecommitdiffstats
path: root/text2pcap.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2002-01-23 08:35:17 +0000
committerGuy Harris <guy@alum.mit.edu>2002-01-23 08:35:17 +0000
commit33a5bc4772a222dc69d2b871e243e4f3ef349ea9 (patch)
treedf4e58e30411518ffd004941abdd27a99a0853ae /text2pcap.c
parent0a979b81b85d66476e5fc5000bd7a8a3e4a0e2a5 (diff)
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
Diffstat (limited to 'text2pcap.c')
-rw-r--r--text2pcap.c16
1 files 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 <ashokn@cisco.com>
*
- * $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 <gerald@ethereal.com>
@@ -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 );