From 8e7396edb4b4ac9580cdddb4feb0903da071905f Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Mon, 4 Jun 2018 20:37:56 -0700 Subject: [PATCH] Don't use FT_STRING fields for non-strings. If you're reporting an error, use an expert info item. If you're putting a structure into the protocol tree, use FT_NONE for the structure as a whole. Change-Id: Ie89b552576b15195acb0a9108d33430115d99f00 Reviewed-on: https://code.wireshark.org/review/28024 Reviewed-by: Guy Harris --- epan/dissectors/packet-ieee80211.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/epan/dissectors/packet-ieee80211.c b/epan/dissectors/packet-ieee80211.c index 449ce07646..5ba2b2b18f 100644 --- a/epan/dissectors/packet-ieee80211.c +++ b/epan/dissectors/packet-ieee80211.c @@ -13686,19 +13686,21 @@ dissect_fast_bss_transition(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, while (offset + 2 <= tag_len) { guint8 id, len; int s_end; + proto_item *ti; + proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_id, tvb, offset, 1, ENC_LITTLE_ENDIAN); id = tvb_get_guint8(tvb, offset); offset += 1; - proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_len, - tvb, offset, 1, ENC_LITTLE_ENDIAN); + ti = proto_tree_add_item(tree, hf_ieee80211_tag_ft_subelem_len, + tvb, offset, 1, ENC_LITTLE_ENDIAN); len = tvb_get_guint8(tvb, offset); offset += 1; if (offset + len > tag_len) { - proto_tree_add_string(tree, hf_ieee80211_tag_interpretation, tvb, offset, - tag_len - offset, "Invalid FTIE subelement"); + expert_add_info_format(pinfo, ti, &ei_ieee80211_tag_length, + "FTIE subelement length is too large for the FTIE content length"); return offset; } @@ -14195,13 +14197,12 @@ dissect_mcs_set(proto_tree *tree, tvbuff_t *tvb, int offset, gboolean basic, gbo /* 16 byte Supported MCS set */ if (vendorspecific) { - ti = proto_tree_add_string(tree, hf_ieee80211_mcsset_vs, tvb, offset, 16, - basic ? "Basic MCS Set" : "MCS Set"); + ti = proto_tree_add_item(tree, hf_ieee80211_mcsset_vs, tvb, offset, 16, ENC_NA); } else { - ti = proto_tree_add_string(tree, hf_ieee80211_mcsset, tvb, offset, 16, - basic ? "Basic MCS Set" : "MCS Set"); + ti = proto_tree_add_item(tree, hf_ieee80211_mcsset, tvb, offset, 16, ENC_NA); } + proto_item_append_text(ti, ": %s", basic ? "Basic MCS Set" : "MCS Set"); mcs_tree = proto_item_add_subtree(ti, ett_mcsset_tree); /* Rx MCS Bitmask */ @@ -28124,12 +28125,12 @@ proto_register_ieee80211(void) {&hf_ieee80211_mcsset, {"Rx Supported Modulation and Coding Scheme Set", "wlan.ht.mcsset", - FT_STRING, BASE_NONE, NULL, 0, + FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, {&hf_ieee80211_mcsset_vs, {"Rx Supported Modulation and Coding Scheme Set (VS)", "wlan.vs.ht.mcsset", - FT_STRING, BASE_NONE, NULL, 0, + FT_NONE, BASE_NONE, NULL, 0, "Vendor Specific Rx Supported Modulation and Coding Scheme Set", HFILL }}, {&hf_ieee80211_mcsset_rx_bitmask,