diff --git a/epan/dissectors/packet-isns.c b/epan/dissectors/packet-isns.c index 800392a27c..fe0fae65fc 100644 --- a/epan/dissectors/packet-isns.c +++ b/epan/dissectors/packet-isns.c @@ -880,7 +880,6 @@ AddAttribute(packet_info *pinfo, tvbuff_t *tvb, proto_tree *tree, guint offset, tvb, offset, 4, ENC_BIG_ENDIAN); offset +=4; - proto_item_set_len(attr_item, 8+len); proto_item_append_text(attr_item, ": %s", val_to_str_ext_const(tag, &isns_attribute_tags_ext, "Unknown")); /* it seems that an empty attribute is always valid, the original code had a similar statement */ @@ -890,6 +889,7 @@ AddAttribute(packet_info *pinfo, tvbuff_t *tvb, proto_tree *tree, guint offset, /* 5.6.5.1 */ proto_tree_add_uint_format_value(tree, hf_isns_portal_group_tag, tvb, offset, 8, 0, ""); } + proto_item_set_len(attr_item, 8+len); return offset; } @@ -1139,6 +1139,11 @@ AddAttribute(packet_info *pinfo, tvbuff_t *tvb, proto_tree *tree, guint offset, proto_tree_add_item(attr_tree, hf_isns_not_decoded_yet, tvb, offset, len, ENC_NA); } + /* Make sure the data is all there - and that the length won't overflow */ + tvb_ensure_bytes_exist(tvb, offset, len); + /* Set the length of the item to cover only the actual item length */ + proto_item_set_len(attr_item, 8+len); + offset += len; return offset; }