提交 2b107d62 编写于 作者: J Jiri Kosina

HID: fix incorrent length condition in hidraw_write()

The bound check on the buffer length

	if (count > HID_MIN_BUFFER_SIZE)

is of course incorrent, the proper check is

	if (count > HID_MAX_BUFFER_SIZE)

Fix it.
Reported-by: NJerry Ryle <jerry@mindtribe.com>
Signed-off-by: NJiri Kosina <jkosina@suse.cz>
上级 d92870dd
......@@ -113,7 +113,7 @@ static ssize_t hidraw_write(struct file *file, const char __user *buffer, size_t
if (!dev->hid_output_raw_report)
return -ENODEV;
if (count > HID_MIN_BUFFER_SIZE) {
if (count > HID_MAX_BUFFER_SIZE) {
printk(KERN_WARNING "hidraw: pid %d passed too large report\n",
task_pid_nr(current));
return -EINVAL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册