aboutsummaryrefslogtreecommitdiffstats
path: root/rawshark.c
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2013-08-23 18:42:51 +0000
committerGerald Combs <gerald@wireshark.org>2013-08-23 18:42:51 +0000
commita4a6af3c5a3245d26245c86cb001b5bc7b7e74b3 (patch)
tree8a2473513acd51db18c002b7f4e2003e240b8d9c /rawshark.c
parentbaaa0eb1a0dfe71646367f58c0148ed4a84d14b6 (diff)
Initialize our wtap_pkthdr struct so that we don't try to dereference an
invalid opt_comment pointer down the line. svn path=/trunk/; revision=51493
Diffstat (limited to 'rawshark.c')
-rw-r--r--rawshark.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/rawshark.c b/rawshark.c
index f5c4519054..1b8f0f8638 100644
--- a/rawshark.c
+++ b/rawshark.c
@@ -955,10 +955,11 @@ raw_pipe_read(struct wtap_pkthdr *phdr, guchar * pd, int *err, const gchar **err
phdr->pkt_encap = encap;
#if 0
- printf("tv_sec: %d (%04x)\n", hdr.ts.tv_sec, hdr.ts.tv_sec);
- printf("tv_usec: %d (%04x)\n", hdr.ts.tv_usec, hdr.ts.tv_usec);
- printf("caplen: %d (%04x)\n", hdr.caplen, hdr.caplen);
- printf("len: %d (%04x)\n", hdr.len, hdr.len);
+ printf("mem_hdr: %lu disk_hdr: %lu\n", sizeof(mem_hdr), sizeof(disk_hdr));
+ printf("tv_sec: %u (%04x)\n", (unsigned int) phdr->ts.secs, (unsigned int) phdr->ts.secs);
+ printf("tv_nsec: %d (%04x)\n", phdr->ts.nsecs, phdr->ts.nsecs);
+ printf("caplen: %d (%04x)\n", phdr->caplen, phdr->caplen);
+ printf("len: %d (%04x)\n", phdr->len, phdr->len);
#endif
if (bytes_needed > WTAP_MAX_PACKET_SIZE) {
*err = WTAP_ERR_BAD_FILE;
@@ -996,6 +997,8 @@ load_cap_file(capture_file *cf)
struct wtap_pkthdr phdr;
guchar pd[WTAP_MAX_PACKET_SIZE];
+ memset(&phdr, 0, sizeof(phdr));
+
while (raw_pipe_read(&phdr, pd, &err, &err_info, &data_offset)) {
process_packet(cf, data_offset, &phdr, pd);
}