From 08a7c94569160eeb6f8e757c361d5e04a6492700 Mon Sep 17 00:00:00 2001 From: 怯花颜 Date: Sun, 24 Oct 2021 01:35:05 +0200 Subject: win32: SPDRP_DRIVER property has a 4-character suffix that is not necessarily an integer --- src/libirecovery.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/libirecovery.c b/src/libirecovery.c index 58a6620..3bcfbf2 100644 --- a/src/libirecovery.c +++ b/src/libirecovery.c @@ -2207,7 +2207,14 @@ static void *_irecv_event_handler(void* data) free(details); continue; } - uint32_t location = strtoul(p+1, NULL, 16); + p++; + uint32_t location = 0; + if (!*p || strlen(p) < 4) { + debug("%s: ERROR: Driver location suffix too short\n", __func__); + free(details); + continue; + } + memcpy(&location, p, 4); int found = 0; FOREACH(struct irecv_usb_device_info *devinfo, &devices) { -- cgit v1.1-32-gdbae