summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar 怯花颜2021-10-24 01:35:05 +0200
committerGravatar Nikias Bassen2021-10-24 01:35:05 +0200
commit08a7c94569160eeb6f8e757c361d5e04a6492700 (patch)
treeedfb5de9883add321adff6b0225b0fc11138d8cd
parentb65c93bc6867480302f2e44186d74a64e8215c94 (diff)
downloadlibirecovery-08a7c94569160eeb6f8e757c361d5e04a6492700.tar.gz
libirecovery-08a7c94569160eeb6f8e757c361d5e04a6492700.tar.bz2
win32: SPDRP_DRIVER property has a 4-character suffix that is not necessarily an integer
-rw-r--r--src/libirecovery.c9
1 files changed, 8 insertions, 1 deletions
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) {