diff options
author | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2023-04-27 08:17:35 +0200 |
---|---|---|
committer | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2023-04-27 08:34:23 +0200 |
commit | 07d67623862270c21a6f3556a25732e9f09b9f6a (patch) | |
tree | 301b7c6cd21b6def06ba6eea0f2337ed6d4dde40 | |
parent | f305b205c5678bfc675ba7f9578343f6ab204899 (diff) | |
download | tcpdump-07d67623862270c21a6f3556a25732e9f09b9f6a.tar.gz |
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
-rw-r--r-- | print-rip.c | 2 | ||||
-rw-r--r-- | tests/TESTLIST | 1 | ||||
-rw-r--r-- | tests/rip_error_hexdump.out | 6 | ||||
-rw-r--r-- | tests/rip_error_hexdump.pcap | bin | 0 -> 108 bytes |
4 files changed, 8 insertions, 1 deletions
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 Binary files differnew file mode 100644 index 00000000..618a029c --- /dev/null +++ b/tests/rip_error_hexdump.pcap |