aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-icmp.c
diff options
context:
space:
mode:
authorishaangandhi <ishaangandhi@gmail.com>2021-04-20 14:07:28 -0400
committerWireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2021-04-20 20:36:07 +0000
commit1e012c2c007d9ef5fd47abfb5fd447229cab6108 (patch)
treeb23b1d4f7b82a40e253a1d2681f50f09226a2b09 /epan/dissectors/packet-icmp.c
parent3173a808a3a27ea3b68306977abc4bcf1988f4fa (diff)
Read ICMP extensions from after the original datagram
RFC 4884 requires ICMP extensions be read after the original datagram. For backwards compatibility, if there is no `icmp_original_dgram_length` field in the packet, we assume they are 128. However, if this field is there, we should prefer to use that.
Diffstat (limited to 'epan/dissectors/packet-icmp.c')
-rw-r--r--epan/dissectors/packet-icmp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/epan/dissectors/packet-icmp.c b/epan/dissectors/packet-icmp.c
index 4dd286c28b..4b332ab0a7 100644
--- a/epan/dissectors/packet-icmp.c
+++ b/epan/dissectors/packet-icmp.c
@@ -1671,7 +1671,8 @@ 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)) {
- tvbuff_t * extension_tvb = tvb_new_subset_remaining(tvb, 8 + 128);
+ int ext_offset = (icmp_original_dgram_length ? 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);
}
break;