aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/erf.c
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2007-11-05 20:43:25 +0000
committerAnders Broman <anders.broman@ericsson.com>2007-11-05 20:43:25 +0000
commite10e84c2438d3acb19b7700f4b8d36a17298b60f (patch)
tree44d2039515f31b34a2b7ee5f023675f90360f985 /wiretap/erf.c
parent3b1f0881e2878ccbc7db209fbd7c924f6d3bb458 (diff)
Strengthen BER and ERF heuristics to solve:
Fail to load I4B traces http://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1972 svn path=/trunk/; revision=23367
Diffstat (limited to 'wiretap/erf.c')
-rw-r--r--wiretap/erf.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/wiretap/erf.c b/wiretap/erf.c
index c12de8c463..87fbae93e5 100644
--- a/wiretap/erf.c
+++ b/wiretap/erf.c
@@ -120,6 +120,14 @@ int erf_open(wtap *wth, int *err, gchar **err_info _U_)
packet_size = g_ntohs(header.rlen) - sizeof(header);
+ if (packet_size > WTAP_MAX_PACKET_SIZE) {
+ /*
+ * Probably a corrupt capture file; don't blow up trying
+ * to allocate space for an immensely-large packet.
+ */
+ return 0;
+ }
+
/* fail on invalid record type, decreasing timestamps or non-zero pad-bits */
/* Not all types within this range are decoded, but it is a first filter */
if (header.type == 0 || header.type > ERF_TYPE_MAX ) {