Commit 8b2910fd authored by Vojtech Pavlik's avatar Vojtech Pavlik

input: Check the range for HIDIOC?USAGES num_values.

Signed-off-by: default avatarVojtech Pavlik <vojtech@suse.cz>
parent 664bc086
......@@ -633,14 +633,11 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd
} else if (uref->usage_index >= field->report_count)
goto inval;
else if ((cmd == HIDIOCGUSAGES ||
cmd == HIDIOCSUSAGES) &&
(uref->usage_index + uref_multi->num_values >=
field->report_count ||
uref->usage_index + uref_multi->num_values <
uref->usage_index))
else if ((cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) &&
(uref_multi->num_values >= HID_MAX_MULTI_USAGES ||
uref->usage_index + uref_multi->num_values >= field->report_count ||
uref->usage_index + uref_multi->num_values < uref->usage_index))
goto inval;
}
switch (cmd) {
......
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