From c1265bc98af90fb1cbb0ad02153b888c009d3c43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20La=C3=ADns?= Date: Thu, 4 Jul 2019 11:33:42 +0100 Subject: [PATCH] hidpp10: fix segfault for the c531 (and possibly other 27MHz receivers) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit hidpp10_read_memory will return the HID++ error if the request fails. right now, the error code from hidpp10_read_memory is transparently passed through hidpp10_onboard_profiles_read_macro. This is problematic because hidpp10_onboard_profiles_parse_macro only aborts on rc < 0 and HID++ error are > 0. Signed-off-by: Filipe LaĆ­ns --- src/hidpp10.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hidpp10.c b/src/hidpp10.c index e0485fd7..e22c5f57 100644 --- a/src/hidpp10.c +++ b/src/hidpp10.c @@ -1161,7 +1161,7 @@ hidpp10_onboard_profiles_parse_macro(struct hidpp10_device *device, hidpp_log_raw(&device->base, "*** macro starts at (0x%02x, 0x%04x) ***\n", page, offset); rc = hidpp10_onboard_profiles_read_macro(device, page, offset, ¯o); - if (rc < 0) + if (rc) return rc; count = rc;