summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Sami Kortelainen2024-09-25 00:34:10 +0200
committerGravatar Nikias Bassen2024-09-25 00:34:10 +0200
commit3039480107e77c08206fb42e202ec3d1ec3609c1 (patch)
tree4e56bfd5aa21e6f6a03cb905f15e2971a867f1ce /src
parent85f4ac0876b886c63446be27f1316bddb72d5195 (diff)
downloadlibirecovery-3039480107e77c08206fb42e202ec3d1ec3609c1.tar.gz
libirecovery-3039480107e77c08206fb42e202ec3d1ec3609c1.tar.bz2
win32: Fix crash due to access to uninitialized data
Diffstat (limited to 'src')
-rw-r--r--src/libirecovery.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libirecovery.c b/src/libirecovery.c
index c7afe7b..efcb7b4 100644
--- a/src/libirecovery.c
+++ b/src/libirecovery.c
@@ -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);