Skip to content

Commit

Permalink
win32: Fix crash due to access to uninitialized data
Browse files Browse the repository at this point in the history
  • Loading branch information
skortela authored and nikias committed Sep 24, 2024
1 parent 85f4ac0 commit 3039480
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/libirecovery.c
Original file line number Diff line number Diff line change
Expand Up @@ -2310,6 +2310,11 @@ static void* _irecv_handle_device_add(void *userdata)

if (product_id == KIS_PRODUCT_ID) {
client = (irecv_client_t)malloc(sizeof(struct irecv_client_private));
if (client == NULL) {
debug("%s: Failed to allocate memory\n", __func__);
return NULL;
}
memset(client, '\0', sizeof(struct irecv_client_private));
client->handle = CreateFileA(result, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);
if (client->handle == INVALID_HANDLE_VALUE) {
debug("%s: Failed to open device path %s\n", __func__, result);
Expand Down

0 comments on commit 3039480

Please sign in to comment.