diff options
author | stig <stig@f5534014-38df-0310-8fa8-9805f1628bb7> | 2009-10-29 21:51:20 +0000 |
---|---|---|
committer | stig <stig@f5534014-38df-0310-8fa8-9805f1628bb7> | 2009-10-29 21:51:20 +0000 |
commit | 01661b551c39667791a411dc25d07678bf4f20e8 (patch) | |
tree | d074619a02350fc7846be6ac24eba8c0fc349c74 /epan/dissectors/packet-usb.c | |
parent | ad47e7a388213794bc8547c47f84e3f9a6312da4 (diff) |
From Marton Nemeth via bug 4181:
Take the USB descriptor length from packet.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@30763 f5534014-38df-0310-8fa8-9805f1628bb7
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; } |