diff --git a/src/hidpp10.c b/src/hidpp10.c index 553dc438..077c6fd7 100644 --- a/src/hidpp10.c +++ b/src/hidpp10.c @@ -1144,6 +1144,9 @@ hidpp10_onboard_profiles_read_macro(struct hidpp10_device *device, } if (rc == -ENOMEM) { + if ((unsigned) offset + mem_index > 0xff) + goto out_err; + offset += mem_index; if (offset & 0x01) offset--;