Commit 722612cd authored by Jiri Kosina's avatar Jiri Kosina

HID: fix parsing of local delimiter with size 0

Acording to HID standard 1.11, value 0 allows for size being 0.
Local delimiter tag has has 0 one of the possible values.

Therefore we need to handle this case properly, to be fully compliant
with the specification.
Reported-by: default avatarMarcin Tolysz <tolysz@gmail.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent cf2f765f
...@@ -387,7 +387,8 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item) ...@@ -387,7 +387,8 @@ static int hid_parser_local(struct hid_parser *parser, struct hid_item *item)
__u32 data; __u32 data;
unsigned n; unsigned n;
if (item->size == 0) { /* Local delimiter could have value 0, which allows size to be 0 */
if (item->size == 0 && item->tag != HID_LOCAL_ITEM_TAG_DELIMITER) {
dbg_hid("item data expected for local item\n"); dbg_hid("item data expected for local item\n");
return -1; return -1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment