mirror of
https://github.com/libratbag/libratbag.git
synced 2026-11-08 07:33:53 +01:00
Avoid overflow when reading dpi list
LONG_MESSAGE_LENGTH is the length of the full message so we should take the first parts of the union into account.
This commit is contained in:
@@ -779,7 +779,7 @@ hidpp20_adjustable_dpi_get_dpi_list(struct ratbag_device *device,
|
||||
sensor->dpi_min = 0xffff;
|
||||
|
||||
sensor->index = msg.msg.parameters[0];
|
||||
while (i < LONG_MESSAGE_LENGTH - 1 &&
|
||||
while (i < LONG_MESSAGE_LENGTH - 4U &&
|
||||
hidpp20_get_unaligned_u16(&msg.msg.parameters[i]) != 0) {
|
||||
uint16_t value = hidpp20_get_unaligned_u16(&msg.msg.parameters[i]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user