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>
This commit is contained in:
Michael Mann 2017-04-12 22:40:32 -04:00
parent a96dc7bdd5
commit f8bbdece59
1 changed files with 9 additions and 2 deletions

View File

@ -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 */