diff options
author | David Lamparter <equinox@diac24.net> | 2024-03-18 16:43:35 +1000 |
---|---|---|
committer | AndersBroman <a.broman58@gmail.com> | 2024-03-20 06:26:56 +0000 |
commit | a9bf01aad1545bccdd133b7bfc04c7399ed381f5 (patch) | |
tree | 4750376d4600c615feb2ef3b9e94d989f0c628af | |
parent | 15660308cfacb294e204402626c72de908ec20db (diff) |
ICMP: fix minimum original datagram length
RFC 4884 section 3 requires the "original datagram" field be at minimum
128 bytes, with zero padding if the original datagram was shorter. (And
this is in fact how routers on the internet behave in generating ICMP
messages with MPLS info.)
The ICMP dissector didn't implement this limit and ended up decoding the
zero padding as multi-part extension. Fix by making 128 be the bottom
cap of padding to skip.
-rw-r--r-- | epan/dissectors/packet-icmp.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/epan/dissectors/packet-icmp.c b/epan/dissectors/packet-icmp.c index 7b8d8d9d59..580ca9b926 100644 --- a/epan/dissectors/packet-icmp.c +++ b/epan/dissectors/packet-icmp.c @@ -1788,7 +1788,7 @@ dissect_icmp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data) if ((tvb_reported_length(tvb) > 8 + 128) && (tvb_get_ntohs(tvb, 8 + 2) <= 128 || favor_icmp_mpls_ext)) { - int ext_offset = (icmp_original_dgram_length ? icmp_original_dgram_length * 4 : 128) + 8; + int ext_offset = MAX(icmp_original_dgram_length * 4, 128) + 8; tvbuff_t * extension_tvb = tvb_new_subset_remaining(tvb, ext_offset); dissect_icmp_extension(extension_tvb, pinfo, icmp_tree, NULL); } |