If stuff above the Wiretap library can't handle packet reported lengths
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 15 Dec 2011 08:22:06 +0000 (08:22 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 15 Dec 2011 08:22:06 +0000 (08:22 +0000)
> WTAP_MAX_PACKET_SIZE, either that should be caught above the
per-file-type layer in Wiretap or should be handled by the caller.

We've recently fixed at least one problem with reported lengths > 2^31 -
1 (by clamping the length to 2^31 - 1), so let's just remove the check
from the pcap-NG reader, to squelch some complaints we're getting from
the buildbot (bug 6673 and its duplicates).

(The pcap reader uses it to cope with some of the botched libpcap
formats that changed the per-packet header without changing the magic
number; I'll look at trying to preserve those heuristics while still
allowing reported lengths > WTAP_MAX_PACKET_SIZE.)

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@40207 f5534014-38df-0310-8fa8-9805f1628bb7

wiretap/pcapng.c

index f5aff4066fbc4091fc49d33275ed806e49ed22e5..1892e34854cb7c258f80423e6ac4fdf5831cb6c3 100644 (file)
@@ -852,12 +852,6 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *pn, wta
                      wblock->data.packet.packet_len,
                      wblock->data.packet.cap_len,
                      wblock->data.packet.interface_id);
-       if (wblock->data.packet.packet_len > WTAP_MAX_PACKET_SIZE) {
-               *err = WTAP_ERR_BAD_FILE;
-               *err_info = g_strdup_printf("pcapng_read_packet_block: packet_len %u is larger than WTAP_MAX_PACKET_SIZE %u.",
-                   wblock->data.packet.packet_len, WTAP_MAX_PACKET_SIZE);
-               return 0;
-       }
 
        wtap_encap = pcapng_get_encap(wblock->data.packet.interface_id, pn);
        pcapng_debug3("pcapng_read_packet_block: encapsulation = %d (%s), pseudo header size = %d.",
@@ -1029,12 +1023,6 @@ pcapng_read_simple_packet_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *
        }
        pcapng_debug1("pcapng_read_simple_packet_block: packet data: packet_len %u",
                       wblock->data.simple_packet.packet_len);
-       if (wblock->data.simple_packet.packet_len > WTAP_MAX_PACKET_SIZE) {
-               *err = WTAP_ERR_BAD_FILE;
-               *err_info = g_strdup_printf("pcapng_read_simple_packet_block: packet_len %u is larger than WTAP_MAX_PACKET_SIZE %u.",
-                   wblock->data.simple_packet.packet_len, WTAP_MAX_PACKET_SIZE);
-               return 0;
-       }
 
        encap = pcapng_get_encap(0, pn);
        pcapng_debug1("pcapng_read_simple_packet_block: Need to read pseudo header of size %d",