mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 19:13:03 -04:00
HID: asus: fix a off-by-one in mcu_parse_version_string() validation
In mcu_parse_version_string() a size validation for response is stricter
that it needs to be: relax the check by one byte.
The device always answer with a greater byte count so this does
not introduce visible changes.
Fixes: ("hid-asus: check ROG Ally MCU version and warn")
Signed-off-by: Denis Benato <denis.benato@linux.dev>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
This commit is contained in:
committed by
Jiri Kosina
parent
fb572e2f23
commit
2a767bd3e0
@@ -841,7 +841,7 @@ static int mcu_parse_version_string(const u8 *response, size_t response_size)
|
||||
dots++;
|
||||
}
|
||||
|
||||
if (dots != 2 || p >= end || (p + 3) >= end)
|
||||
if (dots != 2 || end - p < 3)
|
||||
return -EINVAL;
|
||||
|
||||
memcpy(buf, p, 3);
|
||||
|
||||
Reference in New Issue
Block a user