diff options
| author | 2015-09-23 02:15:34 +0200 | |
|---|---|---|
| committer | 2016-04-01 22:53:13 +0200 | |
| commit | 15173c59a00a8e9c154bd6787e35c243c383160e (patch) | |
| tree | adae442173a98917dd68528dfccb85618d6d890d /src | |
| parent | 35b0543ec2a54250be011a9ffdd1d70f2c1ced5c (diff) | |
| download | libimobiledevice-15173c59a00a8e9c154bd6787e35c243c383160e.tar.gz libimobiledevice-15173c59a00a8e9c154bd6787e35c243c383160e.tar.bz2 | |
Avoid potential NULL pointer dereference (leading to segfault) if functions are called with NULL arguments
Diffstat (limited to 'src')
| -rw-r--r-- | src/installation_proxy.c | 14 | ||||
| -rw-r--r-- | src/lockdown.c | 2 |
2 files changed, 10 insertions, 6 deletions
diff --git a/src/installation_proxy.c b/src/installation_proxy.c index 8bde154..9f367aa 100644 --- a/src/installation_proxy.c +++ b/src/installation_proxy.c | |||
| @@ -847,11 +847,12 @@ LIBIMOBILEDEVICE_API instproxy_error_t instproxy_status_get_error(plist_t status | |||
| 847 | 847 | ||
| 848 | LIBIMOBILEDEVICE_API void instproxy_status_get_name(plist_t status, char **name) | 848 | LIBIMOBILEDEVICE_API void instproxy_status_get_name(plist_t status, char **name) |
| 849 | { | 849 | { |
| 850 | *name = NULL; | ||
| 851 | if (name) { | 850 | if (name) { |
| 852 | plist_t node = plist_dict_get_item(status, "Status"); | 851 | plist_t node = plist_dict_get_item(status, "Status"); |
| 853 | if (node) { | 852 | if (node) { |
| 854 | plist_get_string_val(node, name); | 853 | plist_get_string_val(node, name); |
| 854 | } else { | ||
| 855 | *name = NULL; | ||
| 855 | } | 856 | } |
| 856 | } | 857 | } |
| 857 | } | 858 | } |
| @@ -907,10 +908,13 @@ LIBIMOBILEDEVICE_API void instproxy_status_get_current_list(plist_t status, uint | |||
| 907 | 908 | ||
| 908 | LIBIMOBILEDEVICE_API void instproxy_command_get_name(plist_t command, char** name) | 909 | LIBIMOBILEDEVICE_API void instproxy_command_get_name(plist_t command, char** name) |
| 909 | { | 910 | { |
| 910 | *name = NULL; | 911 | if (name) { |
| 911 | plist_t node = plist_dict_get_item(command, "Command"); | 912 | plist_t node = plist_dict_get_item(command, "Command"); |
| 912 | if (node) { | 913 | if (node) { |
| 913 | plist_get_string_val(node, name); | 914 | plist_get_string_val(node, name); |
| 915 | } else { | ||
| 916 | *name = NULL; | ||
| 917 | } | ||
| 914 | } | 918 | } |
| 915 | } | 919 | } |
| 916 | 920 | ||
diff --git a/src/lockdown.c b/src/lockdown.c index 85124bd..d2e8c74 100644 --- a/src/lockdown.c +++ b/src/lockdown.c | |||
| @@ -637,7 +637,7 @@ LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_get_device_name(lockdownd_clien | |||
| 637 | 637 | ||
| 638 | LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_client_new(idevice_t device, lockdownd_client_t *client, const char *label) | 638 | LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_client_new(idevice_t device, lockdownd_client_t *client, const char *label) |
| 639 | { | 639 | { |
| 640 | if (!client) | 640 | if (!device || !client) |
| 641 | return LOCKDOWN_E_INVALID_ARG; | 641 | return LOCKDOWN_E_INVALID_ARG; |
| 642 | 642 | ||
| 643 | static struct lockdownd_service_descriptor service = { | 643 | static struct lockdownd_service_descriptor service = { |
