From: Francois-Xavier Le Bail Date: Thu, 27 Apr 2023 06:17:35 +0000 (+0200) Subject: RIP: Check if there is some data to hexdump X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/07d67623862270c21a6f3556a25732e9f09b9f6a?ds=inline RIP: Check if there is some data to hexdump This may avoid this error: Dissector error: print_unknown_data() called with pointer past end of packet --- diff --git a/print-rip.c b/print-rip.c index 9e81bb53..57e7e481 100644 --- a/print-rip.c +++ b/print-rip.c @@ -385,7 +385,7 @@ rip_print(netdissect_options *ndo, break; } /* do we want to see an additionally hexdump ? */ - if (ndo->ndo_vflag> 1) { + if (ndo->ndo_vflag > 1 && ND_TTEST_LEN(p, len)) { if (!print_unknown_data(ndo, p, "\n\t", len)) return; } diff --git a/tests/TESTLIST b/tests/TESTLIST index dbc38425..00576f70 100644 --- a/tests/TESTLIST +++ b/tests/TESTLIST @@ -245,6 +245,7 @@ ripv2_auth ripv2_auth.pcap ripv2_auth.out -v # RIP invalid ripv2-invalid-length ripv2-invalid-length.pcap ripv2-invalid-length.out -v +rip_error_hexdump rip_error_hexdump.pcap rip_error_hexdump.out -vv # DHCPv6 tests dhcpv6-aftr-name dhcpv6-AFTR-Name-RFC6334.pcap dhcpv6-AFTR-Name-RFC6334.out -v diff --git a/tests/rip_error_hexdump.out b/tests/rip_error_hexdump.out new file mode 100644 index 00000000..1bfeef54 --- /dev/null +++ b/tests/rip_error_hexdump.out @@ -0,0 +1,6 @@ + 1 12:11:42.563815 IP (tos 0x0, ttl 64, id 1, offset 0, flags [+, DF], proto UDP (17), length 70, bad cksum 0 (->3903)!) + 0.254.96.182.520 > 255.127.128.111.65535: + RIPv2, Request, length: 42, routes: 1 or less + Unknown (26725) Authentication data: + 0x0000: 6901 0202 0421 0001 0281 8181 6bd4 c3b2 + 0x0010: a102 diff --git a/tests/rip_error_hexdump.pcap b/tests/rip_error_hexdump.pcap new file mode 100644 index 00000000..618a029c Binary files /dev/null and b/tests/rip_error_hexdump.pcap differ