aboutsummaryrefslogtreecommitdiffstats
path: root/rawshark.c
diff options
context:
space:
mode:
authorGuy Harris <gharris@sonic.net>2021-04-28 13:16:29 -0700
committerWireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2021-04-28 21:31:15 +0000
commiteb4d68033e33b6aa23b293ee070c5c799381aba4 (patch)
tree1e81772f1a82352dc8c091fcef5ba2e6ac888f63 /rawshark.c
parent21b334fd827c9e37c8973ab7e6625784726be243 (diff)
Don't cast away upper bits when assigning to a nstime_t's secs field.
The secs field is a time_t, which is not necessarily 32 bits. If it's not, casting away the upper bits, by casting to guint32, introduces a Y2.038K bug. Either cast to time_t or, if you're assigning a time_t to it, don't bother with the cast.
Diffstat (limited to 'rawshark.c')
-rw-r--r--rawshark.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/rawshark.c b/rawshark.c
index c148874abf..210f6dcfa0 100644
--- a/rawshark.c
+++ b/rawshark.c
@@ -912,7 +912,7 @@ raw_pipe_read(wtap_rec *rec, Buffer *buf, int *err, gchar **err_info, gint64 *da
#if 0
printf("mem_hdr: %lu disk_hdr: %lu\n", sizeof(mem_hdr), sizeof(disk_hdr));
- printf("tv_sec: %u (%04x)\n", (unsigned int) rec->ts.secs, (unsigned int) rec->ts.secs);
+ printf("tv_sec: %d (%04x)\n", (unsigned int) rec->ts.secs, (unsigned int) rec->ts.secs);
printf("tv_nsec: %d (%04x)\n", rec->ts.nsecs, rec->ts.nsecs);
printf("caplen: %d (%04x)\n", rec->rec_header.packet_header.caplen, rec->rec_header.packet_header.caplen);
printf("len: %d (%04x)\n", rec->rec_header.packet_header.len, rec->rec_header.packet_header.len);
@@ -990,9 +990,8 @@ process_packet(capture_file *cf, epan_dissect_t *edt, gint64 offset,
/* The user sends an empty packet when he wants to get output from us even if we don't currently have
packets to process. We spit out a line with the timestamp and the text "void"
*/
- printf("%lu %lu %lu void -\n", (unsigned long int)cf->count,
- (unsigned long int)rec->ts.secs,
- (unsigned long int)rec->ts.nsecs);
+ printf("%lu %" G_GUINT64_FORMAT " %d void -\n", (unsigned long int)cf->count,
+ (guint64)rec->ts.secs, rec->ts.nsecs);
fflush(stdout);