diff options
author | Nikias Bassen | 2021-07-01 17:47:00 +0200 |
---|---|---|
committer | Nikias Bassen | 2021-07-01 17:47:00 +0200 |
commit | 47f6aec37c2df467bc705b4aaee5cefa0835c131 (patch) | |
tree | 2544861137dad91d16272da8cb7dec20b8134dce | |
parent | 1d9f1e3b200c570a36d8cf1106a6512fd4669ab7 (diff) | |
download | libirecovery-47f6aec37c2df467bc705b4aaee5cefa0835c131.tar.gz libirecovery-47f6aec37c2df467bc705b4aaee5cefa0835c131.tar.bz2 |
Check parameters in irecv_devices_get_device_by_* API and return error if NULL
-rw-r--r-- | src/libirecovery.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libirecovery.c b/src/libirecovery.c index d629663..1defaac 100644 --- a/src/libirecovery.c +++ b/src/libirecovery.c @@ -3225,6 +3225,9 @@ IRECV_API irecv_error_t irecv_devices_get_device_by_client(irecv_client_t client #else int i = 0; + if (!client || !device) + return IRECV_E_INVALID_INPUT; + *device = NULL; if (client->device_info.cpid == 0) { @@ -3245,6 +3248,9 @@ IRECV_API irecv_error_t irecv_devices_get_device_by_client(irecv_client_t client IRECV_API irecv_error_t irecv_devices_get_device_by_product_type(const char* product_type, irecv_device_t* device) { int i = 0; + if (!product_type || !device) + return IRECV_E_INVALID_INPUT; + *device = NULL; for (i = 0; irecv_devices[i].product_type != NULL; i++) { @@ -3260,6 +3266,9 @@ IRECV_API irecv_error_t irecv_devices_get_device_by_product_type(const char* pro IRECV_API irecv_error_t irecv_devices_get_device_by_hardware_model(const char* hardware_model, irecv_device_t* device) { int i = 0; + if (!hardware_model || !device) + return IRECV_E_INVALID_INPUT; + *device = NULL; /* lowercase hardware_model string for proper lookup */ |