summaryrefslogtreecommitdiffstats
path: root/src/installation_proxy.c
diff options
context:
space:
mode:
authorGravatar BALATON Zoltan2015-09-23 02:15:34 +0200
committerGravatar BALATON Zoltan2016-04-01 22:53:13 +0200
commit15173c59a00a8e9c154bd6787e35c243c383160e (patch)
treeadae442173a98917dd68528dfccb85618d6d890d /src/installation_proxy.c
parent35b0543ec2a54250be011a9ffdd1d70f2c1ced5c (diff)
downloadlibimobiledevice-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/installation_proxy.c')
-rw-r--r--src/installation_proxy.c14
1 files changed, 9 insertions, 5 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
LIBIMOBILEDEVICE_API void instproxy_status_get_name(plist_t status, char **name)
{
- *name = NULL;
if (name) {
plist_t node = plist_dict_get_item(status, "Status");
if (node) {
plist_get_string_val(node, name);
+ } else {
+ *name = NULL;
}
}
}
@@ -907,10 +908,13 @@ LIBIMOBILEDEVICE_API void instproxy_status_get_current_list(plist_t status, uint
LIBIMOBILEDEVICE_API void instproxy_command_get_name(plist_t command, char** name)
{
- *name = NULL;
- plist_t node = plist_dict_get_item(command, "Command");
- if (node) {
- plist_get_string_val(node, name);
+ if (name) {
+ plist_t node = plist_dict_get_item(command, "Command");
+ if (node) {
+ plist_get_string_val(node, name);
+ } else {
+ *name = NULL;
+ }
}
}