USB HID: Avoid allocating a huge amount of memory.

Make sure we don't pass a huge number to wmem_array_grow. Closes #16809.
This commit is contained in:
Gerald Combs 2020-08-31 10:44:39 -07:00
parent 0e6027313d
commit 10204490d7
1 changed files with 3 additions and 0 deletions

View File

@ -3443,6 +3443,9 @@ parse_report_descriptor(report_descriptor_t *rdesc)
return FALSE;
usage_max = hid_unpack_value(data, i, size);
if (usage_min >= usage_max) {
goto err;
}
wmem_array_grow(field.usages, usage_max - usage_min);
for (guint32 j = usage_min; j < usage_max; j++)