diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2009-10-29 21:51:20 +0000 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2009-10-29 21:51:20 +0000 |
commit | 1e20ff263884c2a9d0fae28318b832b75053f901 (patch) | |
tree | d074619a02350fc7846be6ac24eba8c0fc349c74 /epan/dissectors/packet-usb.c | |
parent | 6a2aae878d6fae03f67f447246aaff856543aab7 (diff) | |
download | wireshark-1e20ff263884c2a9d0fae28318b832b75053f901.tar.gz |
From Marton Nemeth via bug 4181:
Take the USB descriptor length from packet.
svn path=/trunk/; revision=30763
Diffstat (limited to 'epan/dissectors/packet-usb.c')
-rw-r--r-- | epan/dissectors/packet-usb.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/epan/dissectors/packet-usb.c b/epan/dissectors/packet-usb.c index b80edd6334..a76229a38e 100644 --- a/epan/dissectors/packet-usb.c +++ b/epan/dissectors/packet-usb.c @@ -833,6 +833,7 @@ dissect_usb_interface_descriptor(packet_info *pinfo, proto_tree *parent_tree, tv proto_item *item=NULL; proto_tree *tree=NULL; int old_offset=offset; + guint8 len; if(parent_tree){ item=proto_tree_add_text(parent_tree, tvb, offset, -1, "INTERFACE DESCRIPTOR"); @@ -841,6 +842,7 @@ dissect_usb_interface_descriptor(packet_info *pinfo, proto_tree *parent_tree, tv /* bLength */ proto_tree_add_item(tree, hf_usb_bLength, tvb, offset, 1, TRUE); + len = tvb_get_guint8(tvb, offset); offset++; /* bDescriptorType */ @@ -883,8 +885,12 @@ dissect_usb_interface_descriptor(packet_info *pinfo, proto_tree *parent_tree, tv offset++; if(item){ - proto_item_set_len(item, offset-old_offset); + proto_item_set_len(item, len); + } + if (offset != old_offset + len) { + /* unknown records */ } + offset = old_offset + len; return offset; } @@ -905,6 +911,7 @@ dissect_usb_endpoint_descriptor(packet_info *pinfo, proto_tree *parent_tree, tvb proto_tree *ep_attrib_tree=NULL; int old_offset=offset; guint8 endpoint; + guint8 len; if(parent_tree){ item=proto_tree_add_text(parent_tree, tvb, offset, -1, "ENDPOINT DESCRIPTOR"); @@ -913,6 +920,7 @@ dissect_usb_endpoint_descriptor(packet_info *pinfo, proto_tree *parent_tree, tvb /* bLength */ proto_tree_add_item(tree, hf_usb_bLength, tvb, offset, 1, TRUE); + len = tvb_get_guint8(tvb, offset); offset++; /* bDescriptorType */ @@ -990,8 +998,12 @@ dissect_usb_endpoint_descriptor(packet_info *pinfo, proto_tree *parent_tree, tvb offset++; if(item){ - proto_item_set_len(item, offset-old_offset); + proto_item_set_len(item, len); + } + if (offset != old_offset + len) { + /* unknown records */ } + offset = old_offset + len; return offset; } |