Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6dea9347 authored by Ben Collins's avatar Ben Collins Committed by Dmitry Torokhov
Browse files

Input: hiddev - fix off-by-one for num_values in uref_multi requests



Found this when working with a HAPP UGCI device. It has a usage with 7
indexes. I could read them all one at a time, but using a multiref it
would only allow me to read the first 6. The patch below fixed it.

Signed-off-by: default avatarBen Collins <bcollins@ubuntu.com>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent 97d4ebfe
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -632,7 +632,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd


			else if ((cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) &&
			else if ((cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) &&
				 (uref_multi->num_values > HID_MAX_MULTI_USAGES ||
				 (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 > field->report_count))
				goto inval;
				goto inval;
			}
			}