summaryrefslogtreecommitdiff
path: root/wiretap/iseries.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2016-05-01 17:02:12 -0700
committerGuy Harris <guy@alum.mit.edu>2016-05-02 00:08:32 +0000
commit7666361bf968057e400d3e73ccc12723707e3646 (patch)
treedb0888307c9fd506b39681528f8ffaa4222baf36 /wiretap/iseries.c
parenta27fc1101310065a50795a95a6a5487446d01b80 (diff)
downloadwireshark-7666361bf968057e400d3e73ccc12723707e3646.tar.gz
Make sure the packet length isn't > WTAP_MAX_PACKET_SIZE.
Change-Id: I65c1e87e2fcff93b3db998666ff51f19ecd71b55 Reviewed-on: https://code.wireshark.org/review/15233 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap/iseries.c')
-rw-r--r--wiretap/iseries.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/wiretap/iseries.c b/wiretap/iseries.c
index 4f446eee33..c2e6c41730 100644
--- a/wiretap/iseries.c
+++ b/wiretap/iseries.c
@@ -680,7 +680,25 @@ iseries_parse_packet (wtap * wth, FILE_T fh, struct wtap_pkthdr *phdr,
/*
* XXX - The Capture length returned by the iSeries trace doesn't
* seem to include the Ethernet header, so we add its length here.
+ *
+ * Check the length first, just in case it's *so* big that, after
+ * adding the Ethernet header length, it overflows.
*/
+ if (pkt_len > WTAP_MAX_PACKET_SIZE - 14)
+ {
+ /*
+ * Probably a corrupt capture file; don't blow up trying
+ * to allocate space for an immensely-large packet, and
+ * don't think it's a really *small* packet because it
+ * overflowed. (Calculate the size as a 64-bit value in
+ * the error message, to avoid an overflow.)
+ */
+ *err = WTAP_ERR_BAD_FILE;
+ *err_info = g_strdup_printf("iseries: File has %" G_GUINT64_FORMAT "-byte packet, bigger than maximum of %u",
+ (guint64)pkt_len + 14,
+ WTAP_MAX_PACKET_SIZE);
+ return FALSE;
+ }
pkt_len += 14;
break;
}