From 3fe879b88e53f3388653dde9a4631b45ca7290c7 Mon Sep 17 00:00:00 2001 From: Martin Kaiser Date: Mon, 13 Jun 2016 09:30:30 -0700 Subject: isns: fix dead code do the special handling for len==0 and tag==ISNS_ATTR_TAG_PORTAL_GROUP_TAG before going into the different attributes Bug: 12503 Change-Id: I4dd6dcea25aba2e4963811a7a85f1eed1b906bcd Reviewed-on: https://code.wireshark.org/review/15875 Reviewed-by: Michael Mann Petri-Dish: Michael Mann Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- epan/dissectors/packet-isns.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'epan/dissectors/packet-isns.c') diff --git a/epan/dissectors/packet-isns.c b/epan/dissectors/packet-isns.c index f4d88aa6a7..109213bf6a 100644 --- a/epan/dissectors/packet-isns.c +++ b/epan/dissectors/packet-isns.c @@ -884,8 +884,14 @@ AddAttribute(packet_info *pinfo, tvbuff_t *tvb, proto_tree *tree, guint offset, 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 */ - if (len==0) + if (len==0) { + if ((tag==ISNS_ATTR_TAG_PORTAL_GROUP_TAG) && + ((function_id==ISNS_FUNC_DEVATTRREG) || (function_id==ISNS_FUNC_RSP_DEVATTRREG))) { + /* 5.6.5.1 */ + proto_tree_add_uint_format_value(tree, hf_isns_portal_group_tag, tvb, offset, 8, 0, ""); + } return offset; + } switch( tag ) { @@ -986,14 +992,8 @@ AddAttribute(packet_info *pinfo, tvbuff_t *tvb, proto_tree *tree, guint offset, dissect_isns_attr_port(tvb, offset, attr_tree, hf_isns_pg_portal_port, ISNS_OTHER_PORT, pinfo); break; case ISNS_ATTR_TAG_PORTAL_GROUP_TAG: - if((len==0) && ((function_id==ISNS_FUNC_DEVATTRREG) || (function_id==ISNS_FUNC_RSP_DEVATTRREG))) { - /* 5.6.5.1 */ - proto_tree_add_uint_format_value(tree, hf_isns_portal_group_tag, tvb, offset, 8, 0, ""); - } - else { - ISNS_REQUIRE_ATTR_LEN(4); - proto_tree_add_item(attr_tree, hf_isns_portal_group_tag, tvb, offset, len, ENC_BIG_ENDIAN); - } + ISNS_REQUIRE_ATTR_LEN(4); + proto_tree_add_item(attr_tree, hf_isns_portal_group_tag, tvb, offset, len, ENC_BIG_ENDIAN); break; case ISNS_ATTR_TAG_PORTAL_GROUP_INDEX: ISNS_REQUIRE_ATTR_LEN(4); -- cgit v1.2.3