]> The Tcpdump Group git mirrors - tcpdump/commit
Have routines that set the snapend take a buffer pointer and length as args.
authorGuy Harris <[email protected]>
Thu, 31 Mar 2022 09:29:19 +0000 (02:29 -0700)
committerGuy Harris <[email protected]>
Thu, 31 Mar 2022 09:29:19 +0000 (02:29 -0700)
commit6a681e6a16943fb363b5403e84272a1ddaccf28e
treecb5d9d72a18e02b59814b60dbe9099b2da56c900
parent6bd6fe46630359208a2948451e2ce52db1002cd0
Have routines that set the snapend take a buffer pointer and length as args.

Have nd_push_buffer() take a snapshot length, not a snapshot end, as
its last argument.

Replace nd_push_snapend() and nd_change_snapend() with nd_push_snaplen()
and nd_change_snaplen(), both of which take a pointer into the packet
buffer and snapshot length relative to that pointer as arguments.  Have
those routines check the snapshot length to make sure it's not bigger
than the number of bytes in the packet past the pointer, and silently
ignore the requst if it is.

Using a length rather than a pointer avoids the possibility of the
calculation of the snapshot end overflowing and resulting in a snapshot
end *before* the point in the buffer.

Add a test for this, with a capture file containing an IPv6 packet with
an extremely large "jumbo" packet size.

Revert the "Make sure we don't set the snapend before the beginning of
the packet." changes, as they no longer apply with this change (which
also makes sure we don't set the snapend before the beginning of the
packet).
netdissect.c
netdissect.h
print-esp.c
print-ether.c
print-ip.c
print-ip6.c
print.c
tests/TESTLIST
tests/ipv6-too-long-jumbo.out [new file with mode: 0644]
tests/ipv6-too-long-jumbo.pcap [new file with mode: 0644]