From: Francois-Xavier Le Bail Date: Mon, 6 Jun 2022 14:36:57 +0000 (+0200) Subject: PPP: Add tests to avoid incorrectly re-entering ppp_hdlc() X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/26231dad8b681c1b62d16a57aa5a4e28afb04b59?hp=80f4fbf961e4dd58d71f68277ad54230ae040fa7 PPP: Add tests to avoid incorrectly re-entering ppp_hdlc() --- diff --git a/print-ppp.c b/print-ppp.c index 76494410..8e63b4a1 100644 --- a/print-ppp.c +++ b/print-ppp.c @@ -1428,10 +1428,16 @@ ppp_hdlc(netdissect_options *ndo, if (length < 4) goto trunc; proto = GET_BE_U_2(b + 2); /* load the PPP proto-id */ - handle_ppp(ndo, proto, b + 4, length - 4); + if ((proto & 0xff00) == 0x7e00) + ND_PRINT("(protocol 0x%04x invalid)", proto); + else + handle_ppp(ndo, proto, b + 4, length - 4); break; default: /* last guess - proto must be a PPP proto-id */ - handle_ppp(ndo, proto, b + 2, length - 2); + if ((proto & 0xff00) == 0x7e00) + ND_PRINT("(protocol 0x%04x invalid)", proto); + else + handle_ppp(ndo, proto, b + 2, length - 2); break; } diff --git a/tests/of10_inv_QUEUE_GET_CONFIG_REPLY-vv.out b/tests/of10_inv_QUEUE_GET_CONFIG_REPLY-vv.out index 60bc83e9..f9f4b6e2 100644 --- a/tests/of10_inv_QUEUE_GET_CONFIG_REPLY-vv.out +++ b/tests/of10_inv_QUEUE_GET_CONFIG_REPLY-vv.out @@ -1,8 +1 @@ - 1 06:10:40.134396994 : IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 1540, bad cksum 11ce (->4fbd)!) - 109.74.202.0.6653 > 4.184.169.52.4708: Flags [P.], cksum 0x8000 (incorrect -> 0x4d3b), seq 3422244149:3422245637, ack 774246557, win 0, options [nop,nop,unknown-16 0x112e355c0302fa3b], length 1488: OpenFlow - version 1.0, type QUEUE_GET_CONFIG_REPLY, length 278, xid 0xc7ffffff - port 64773 - queue_id 0, len 255 - property NONE, len 0 [property length 0 < 8] (invalid) - [remaining length 7 < 8] (invalid) - version unknown (0x12), type unknown (0x12), length 4626, xid 0x12121212 [|openflow] + 1 06:10:40.134396994 : (protocol 0x7e7e invalid)