usb: don't THROW() an exception from a dissector

the code in question deals with the scenario where the length field's
value is larger than the number of remaining bytes

we can simply stop the dissection if truncation of the data is expected

if not, we continue disecting and we'll get an exception when we reached
the end of the data...

Change-Id: I3f29df694d9ea7d41f19511d267ef6b785527e3c
Reviewed-on: https://code.wireshark.org/review/13624
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
This commit is contained in:
Martin Kaiser 2016-01-31 15:58:34 +01:00
parent cb241e95db
commit 6641987c89
1 changed files with 2 additions and 4 deletions

View File

@ -2061,10 +2061,8 @@ dissect_usb_configuration_descriptor(packet_info *pinfo _U_, proto_tree *parent_
}
if ((remaining_tvb == 0) || (next_len > remaining_tvb)) {
if (!truncation_expected) {
THROW(ReportedBoundsError);
}
break;
if (truncation_expected)
break;
}
next_type = tvb_get_guint8(tvb, offset+1);