aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-usb.c
diff options
context:
space:
mode:
authorSean O. Stalley <sean.stalley@intel.com>2014-09-16 14:03:03 -0700
committerEvan Huus <eapache@gmail.com>2014-09-17 02:21:17 +0000
commitb53405cd5a7b1c2d2f4578a92ac957504a08f3e1 (patch)
tree3e3fa0625c4d87dc7039802c206a2184f47dc665 /epan/dissectors/packet-usb.c
parent4cf9e71730df47281f53d736e43e76ba2beb96c5 (diff)
Fixed dissection of 8-byte device descriptors
during usb device enumeration, a host may attempt to only read the first 8 bytes of a device descriptor. Dissecting a partial device descriptor was throwing a bounds error. Change-Id: I09cdd356d15153afc93ee478fdd98329495a642a Reviewed-on: https://code.wireshark.org/review/4137 Reviewed-by: Evan Huus <eapache@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-usb.c')
-rw-r--r--epan/dissectors/packet-usb.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/epan/dissectors/packet-usb.c b/epan/dissectors/packet-usb.c
index 59b2724f40..91dc12a985 100644
--- a/epan/dissectors/packet-usb.c
+++ b/epan/dissectors/packet-usb.c
@@ -1466,6 +1466,13 @@ dissect_usb_device_descriptor(packet_info *pinfo, proto_tree *parent_tree,
proto_tree_add_item(tree, hf_usb_bMaxPacketSize0, tvb, offset, 1, ENC_LITTLE_ENDIAN);
offset += 1;
+ /* if request was only for the first 8 bytes */
+ /* per 5.5.3 of USB2.0 Spec */
+ if (8 == usb_conv_info->usb_trans_info->setup.wLength) {
+ proto_item_set_len(item, offset-old_offset);
+ return offset;
+ }
+
/* idVendor */
proto_tree_add_item(tree, hf_usb_idVendor, tvb, offset, 2, ENC_LITTLE_ENDIAN);
vendor_id = tvb_get_letohs(tvb, offset);