WLAN: fix IEEE802.11 dissection bug

When parsing wlan header above capwap, first two bytes are swapped (fcf
and flag). the offset was handled incorrectly, causing wireshark to
display incorrect fcf data in the tree summery and completely wrong
flags information (in the case of swap, the flags point to the same
byte as the fcf)
This commit is contained in:
Roi Berkovich 2022-07-12 22:34:43 +03:00 committed by A Wireshark GitLab Utility
parent b9ee6f4563
commit 4702e3bfad
1 changed files with 8 additions and 3 deletions

View File

@ -23635,6 +23635,7 @@ dissect_frame_control(proto_tree *tree, tvbuff_t *tvb, guint32 option_flags,
guint16 fcf, flags, frame_type_subtype;
proto_tree *fc_tree, *flag_tree;
proto_item *fc_item, *flag_item, *hidden_item, *ti;
guint32 swap_offset = 0;
fcf = FETCH_FCF(offset);
@ -23644,15 +23645,18 @@ dissect_frame_control(proto_tree *tree, tvbuff_t *tvb, guint32 option_flags,
/* Swap offset... */
if(option_flags & IEEE80211_COMMON_OPT_BROKEN_FC)
{
offset += 1;
swap_offset += 1;
}
proto_tree_add_uint(tree, hf_ieee80211_fc_frame_type_subtype, tvb, offset, 1, frame_type_subtype);
proto_tree_add_uint(tree, hf_ieee80211_fc_frame_type_subtype, tvb, offset + swap_offset, 1, frame_type_subtype);
fc_item = proto_tree_add_item(tree, hf_ieee80211_fc_field, tvb, offset, 2, ENC_BIG_ENDIAN);
fc_tree = proto_item_add_subtree(fc_item, ett_fc_tree);
/* at this point, we can permanently fix the offset, so that it will be used to parse the fcf first 8 bits */
offset += swap_offset;
proto_tree_add_item(fc_tree, hf_ieee80211_fc_proto_version, tvb, offset, 1, ENC_NA);
proto_tree_add_item(fc_tree, hf_ieee80211_fc_frame_type, tvb, offset, 1, ENC_NA);
proto_tree_add_item(fc_tree, hf_ieee80211_fc_frame_subtype, tvb, offset, 1, ENC_NA);
@ -23660,13 +23664,14 @@ dissect_frame_control(proto_tree *tree, tvbuff_t *tvb, guint32 option_flags,
if(IS_FRAME_EXTENSION(fcf) == 1) {
proto_tree_add_uint(fc_tree, hf_ieee80211_fc_frame_extension, tvb, offset, 1, FCF_FRAME_EXTENSION(fcf));
}
offset += 1;
/* Reswap offset...*/
if(option_flags & IEEE80211_COMMON_OPT_BROKEN_FC)
{
offset -= 1;
proto_item_append_text(fc_item, "(Swapped)");
} else {
offset += 1;
}
/*