summaryrefslogtreecommitdiffstats
path: root/src/libirecovery.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2021-07-01 17:47:00 +0200
committerGravatar Nikias Bassen2021-07-01 17:47:00 +0200
commit47f6aec37c2df467bc705b4aaee5cefa0835c131 (patch)
tree2544861137dad91d16272da8cb7dec20b8134dce /src/libirecovery.c
parent1d9f1e3b200c570a36d8cf1106a6512fd4669ab7 (diff)
downloadlibirecovery-47f6aec37c2df467bc705b4aaee5cefa0835c131.tar.gz
libirecovery-47f6aec37c2df467bc705b4aaee5cefa0835c131.tar.bz2
Check parameters in irecv_devices_get_device_by_* API and return error if NULL
Diffstat (limited to 'src/libirecovery.c')
-rw-r--r--src/libirecovery.c9
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
3225#else 3225#else
3226 int i = 0; 3226 int i = 0;
3227 3227
3228 if (!client || !device)
3229 return IRECV_E_INVALID_INPUT;
3230
3228 *device = NULL; 3231 *device = NULL;
3229 3232
3230 if (client->device_info.cpid == 0) { 3233 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
3245IRECV_API irecv_error_t irecv_devices_get_device_by_product_type(const char* product_type, irecv_device_t* device) { 3248IRECV_API irecv_error_t irecv_devices_get_device_by_product_type(const char* product_type, irecv_device_t* device) {
3246 int i = 0; 3249 int i = 0;
3247 3250
3251 if (!product_type || !device)
3252 return IRECV_E_INVALID_INPUT;
3253
3248 *device = NULL; 3254 *device = NULL;
3249 3255
3250 for (i = 0; irecv_devices[i].product_type != NULL; i++) { 3256 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
3260IRECV_API irecv_error_t irecv_devices_get_device_by_hardware_model(const char* hardware_model, irecv_device_t* device) { 3266IRECV_API irecv_error_t irecv_devices_get_device_by_hardware_model(const char* hardware_model, irecv_device_t* device) {
3261 int i = 0; 3267 int i = 0;
3262 3268
3269 if (!hardware_model || !device)
3270 return IRECV_E_INVALID_INPUT;
3271
3263 *device = NULL; 3272 *device = NULL;
3264 3273
3265 /* lowercase hardware_model string for proper lookup */ 3274 /* lowercase hardware_model string for proper lookup */