diff options
author | Evan Huus <eapache@gmail.com> | 2013-02-20 20:49:36 +0000 |
---|---|---|
committer | Evan Huus <eapache@gmail.com> | 2013-02-20 20:49:36 +0000 |
commit | d7865654fc777dacbedd22276f46ead3e7d01eca (patch) | |
tree | 8320fe5b01175d44e61842ac768d03fc616bb412 /epan/dissectors/packet-hartip.c | |
parent | 4b8a9dfefacd4c0a0f4116c69daec226c2955a2c (diff) |
From Chris Maynard via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8360
Bail out if length is less than the minimum required length.
svn path=/trunk/; revision=47776
Diffstat (limited to 'epan/dissectors/packet-hartip.c')
-rw-r--r-- | epan/dissectors/packet-hartip.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/epan/dissectors/packet-hartip.c b/epan/dissectors/packet-hartip.c index f92bd4257a..4a84d82c7d 100644 --- a/epan/dissectors/packet-hartip.c +++ b/epan/dissectors/packet-hartip.c @@ -857,7 +857,7 @@ dissect_hartip_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, length = tvb_get_ntohs(tvb, offset+6); - hart_item = proto_tree_add_item(tree, proto_hartip, tvb, 0, length, ENC_NA ); + hart_item = proto_tree_add_item(tree, proto_hartip, tvb, 0, length, ENC_NA); hartip_tree = proto_item_add_subtree(hart_item, ett_hartip); ti = proto_tree_add_text(hartip_tree, tvb, offset, HARTIP_HEADER_LENGTH, "HART_IP Header"); @@ -904,6 +904,8 @@ dissect_hartip_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree_add_item(hdr_tree, hf_hartip_hdr_msg_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; + if (length < HARTIP_HEADER_LENGTH) + return tvb_reported_length(tvb); bodylen = length - HARTIP_HEADER_LENGTH; /* add body elements. */ |