diff options
author | Michael Mann <mmann78@netscape.net> | 2017-04-12 22:40:32 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2017-04-13 11:19:43 +0000 |
commit | f8bbdece59b2d7c0b81869a4b0fd991e74e162ab (patch) | |
tree | bc7f2c572a50395e2a089362ba7a159da0355c8d /epan/dissectors | |
parent | a96dc7bdd580fdbe4934b5de483742689b553a0a (diff) |
Bugfix bad checksum of ICMP extension header.
Use offset in tvb, not 0 for computation.
Also add check for checksum = 0, which means checksum isn't present.
Bug: 13586
Change-Id: I18812894104c35e50ecb99aa8eca6b030c78c486
Reviewed-on: https://code.wireshark.org/review/21070
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/packet-icmp.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/epan/dissectors/packet-icmp.c b/epan/dissectors/packet-icmp.c index e6350b8c18..7f59b9917b 100644 --- a/epan/dissectors/packet-icmp.c +++ b/epan/dissectors/packet-icmp.c @@ -777,7 +777,7 @@ dissect_extensions(tvbuff_t * tvb, packet_info *pinfo, gint offset, proto_tree * guint8 version; guint8 class_num; guint8 c_type; - guint16 obj_length, obj_trunc_length; + guint16 obj_length, obj_trunc_length, checksum; proto_item *ti, *tf_object; proto_tree *ext_tree, *ext_object_tree; gint obj_end_offset; @@ -810,8 +810,15 @@ dissect_extensions(tvbuff_t * tvb, packet_info *pinfo, gint offset, proto_tree * tvb, offset, 2, ENC_BIG_ENDIAN); /* Checksum */ + checksum = tvb_get_ntohs(tvb, offset + 2); + if (checksum == 0) { + proto_tree_add_checksum(ext_tree, tvb, offset + 2, hf_icmp_ext_checksum, hf_icmp_ext_checksum_status, &ei_icmp_ext_checksum, + pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NOT_PRESENT); + + } else { proto_tree_add_checksum(ext_tree, tvb, offset + 2, hf_icmp_ext_checksum, hf_icmp_ext_checksum_status, &ei_icmp_ext_checksum, - pinfo, ip_checksum_tvb(tvb, 0, reported_length), ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM); + pinfo, ip_checksum_tvb(tvb, offset, reported_length), ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM); + } if (version != 1 && version != 2) { /* Unsupported version */ |