From d53454bcb37e09dee2401e25eccf15879a54379d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20La=C3=ADns?= Date: Thu, 16 Apr 2020 16:10:48 +0100 Subject: [PATCH] hidpp10: fix circular loop on hidpp10_onboard_profiles_read_macro MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Filipe LaĆ­ns --- src/hidpp10.c | 3 +++ 1 file changed, 3 insertions(+) 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--;