ieee802.11: Ensure optional sub-elements do not cause exceptions.

The original code was causing a malformed packet exception if there was
one additional byte after the measurement pilot interval.

Bug: 15903
Change-Id: Ibe3e7fab5ea5c3d18ea4792ff342a0d8b8d2533b
Reviewed-on: https://code.wireshark.org/review/33858
Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
Petri-Dish: Richard Sharpe <realrichardsharpe@gmail.com>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
This commit is contained in:
Richard Sharpe 2019-07-06 19:13:54 -04:00 committed by Peter Wu
parent df28091c09
commit c32d27aa57
1 changed files with 6 additions and 0 deletions

View File

@ -16725,6 +16725,12 @@ dissect_measurement_pilot_trans_ie(tvbuff_t *tvb, packet_info *pinfo _U_, proto_
while (tag_len > 0) {
guint8 elt_len;
if (tvb_reported_length_remaining(tvb, offset) < 2) {
proto_tree_add_expert_format(tree, pinfo, &ei_ieee80211_bad_length,
tvb, offset, tag_len - offset,
"Remaining data does not include the tag length");
break;
}
elt_len = tvb_get_guint8(tvb, offset + 1);
if(add_tagged_field(pinfo, tree, tvb, offset + 2, 0, ids, G_N_ELEMENTS(ids), NULL) == 0){