pcapng: make SPB cap_len the same as packet_len if IDB snaplen is 0
authorHadriel Kaplan <hadrielk@yahoo.com>
Sat, 29 Aug 2015 14:00:02 +0000 (10:00 -0400)
committerHadriel Kaplan <hadrielk@yahoo.com>
Sat, 29 Aug 2015 14:54:59 +0000 (14:54 +0000)
An IDB snaplen of 0 means no limit, so a Simple Packet Block's capture
length should be the same as its encoded packet length in such a case.

Bug: 11483
Change-Id: I8856d6c6a669a0048ea64b3adbd23c37a598431d
Reviewed-on: https://code.wireshark.org/review/10303
Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
wiretap/pcapng.c

index 8bc118800f764a3b1d17baaf7c7b2a642054e050..27645e4929cc2a78cbb646313b15702ec213edef 100644 (file)
@@ -1481,10 +1481,11 @@ pcapng_read_simple_packet_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *
     /*
      * The captured length is not a field in the SPB; it can be
      * calculated as the minimum of the snapshot length from the
-     * IDB and the packet length, as per the pcap-ng spec.
+     * IDB and the packet length, as per the pcap-ng spec. An IDB
+     * snapshot length of 0 means no limit.
      */
     simple_packet.cap_len = simple_packet.packet_len;
-    if (simple_packet.cap_len > iface_info.snap_len)
+    if (simple_packet.cap_len > iface_info.snap_len && iface_info.snap_len != 0)
         simple_packet.cap_len = iface_info.snap_len;
 
     /*