aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-usb-hid.c
diff options
context:
space:
mode:
authorBerk Akinci <berka@alum.wpi.edu>2021-08-30 17:16:09 -0400
committerWireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2021-08-31 14:14:33 +0000
commit40685047a5327226f756f37734c626f286313817 (patch)
tree2eb7a452ffb047a1a90c6b01e4cf0e27496e7318 /epan/dissectors/packet-usb-hid.c
parent8223405abc5f10de231b9aa2f938478c1db10ace (diff)
USBHID: Report Descriptor: Fix Push and Pop global item parsing.
Still to do: fix the corresponding HID data parsing.
Diffstat (limited to 'epan/dissectors/packet-usb-hid.c')
-rw-r--r--epan/dissectors/packet-usb-hid.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/epan/dissectors/packet-usb-hid.c b/epan/dissectors/packet-usb-hid.c
index ff8164ecb1..a212088015 100644
--- a/epan/dissectors/packet-usb-hid.c
+++ b/epan/dissectors/packet-usb-hid.c
@@ -4195,12 +4195,18 @@ dissect_usb_hid_report_globalitem_data(packet_info *pinfo _U_, proto_tree *tree,
proto_item_append_text(ti, " (%u)", val);
break;
case USBHID_GLOBALITEM_TAG_PUSH:
- proto_tree_add_item_ret_uint(tree, hf_usb_hid_globalitem_push, tvb, offset, bSize, ENC_LITTLE_ENDIAN, &val);
- proto_item_append_text(ti, " (%u)", val);
+ // Push and Pop have no data, but the HID spec 6.2.2.7 doesn't prohibit it.
+ if(bSize > 0) {
+ proto_tree_add_item_ret_uint(tree, hf_usb_hid_globalitem_push, tvb, offset, bSize, ENC_LITTLE_ENDIAN, &val);
+ proto_item_append_text(ti, " (%u)", val);
+ }
break;
case USBHID_GLOBALITEM_TAG_POP:
- proto_tree_add_item_ret_uint(tree, hf_usb_hid_globalitem_pop, tvb, offset, bSize, ENC_LITTLE_ENDIAN, &val);
- proto_item_append_text(ti, " (%u)", val);
+ // Push and Pop have no data, but the HID spec 6.2.2.7 doesn't prohibit it.
+ if(bSize > 0) {
+ proto_tree_add_item_ret_uint(tree, hf_usb_hid_globalitem_pop, tvb, offset, bSize, ENC_LITTLE_ENDIAN, &val);
+ proto_item_append_text(ti, " (%u)", val);
+ }
break;
default:
proto_tree_add_item(tree, hf_usb_hid_item_unk_data, tvb, offset, bSize, ENC_NA);