Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libplist
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pwn
libplist
Commits
ef6206f5
Commit
ef6206f5
authored
Aug 17, 2008
by
Jonathan Beck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use NULL at end of dictionary values (fixes a memory leak).
parent
ab38ab2e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
10 deletions
+9
-10
lockdown.c
src/lockdown.c
+6
-6
plist.c
src/plist.c
+3
-4
No files found.
src/lockdown.c
View file @
ef6206f5
...
@@ -202,7 +202,7 @@ int lockdownd_hello(lockdownd_client *control) {
...
@@ -202,7 +202,7 @@ int lockdownd_hello(lockdownd_client *control) {
xmlFreeDoc
(
plist
);
xmlFreeDoc
(
plist
);
free
(
XML_content
);
free
(
XML_content
);
for
(
i
=
0
;
strcmp
(
dictionary
[
i
],
""
)
;
i
+=
2
)
{
for
(
i
=
0
;
dictionary
[
i
]
;
i
+=
2
)
{
if
(
!
strcmp
(
dictionary
[
i
],
"Result"
)
&&
!
strcmp
(
dictionary
[
i
+
1
],
"Success"
))
{
if
(
!
strcmp
(
dictionary
[
i
],
"Result"
)
&&
!
strcmp
(
dictionary
[
i
+
1
],
"Success"
))
{
free_dictionary
(
dictionary
);
free_dictionary
(
dictionary
);
if
(
debug
)
printf
(
"lockdownd_hello(): success
\n
"
);
if
(
debug
)
printf
(
"lockdownd_hello(): success
\n
"
);
...
@@ -258,7 +258,7 @@ int lockdownd_get_device_public_key(lockdownd_client *control, char **public_key
...
@@ -258,7 +258,7 @@ int lockdownd_get_device_public_key(lockdownd_client *control, char **public_key
free
(
XML_content
);
free
(
XML_content
);
int
success
=
0
;
int
success
=
0
;
for
(
i
=
0
;
strcmp
(
dictionary
[
i
],
""
)
;
i
+=
2
)
{
for
(
i
=
0
;
dictionary
[
i
]
;
i
+=
2
)
{
if
(
!
strcmp
(
dictionary
[
i
],
"Result"
)
&&
!
strcmp
(
dictionary
[
i
+
1
],
"Success"
))
{
if
(
!
strcmp
(
dictionary
[
i
],
"Result"
)
&&
!
strcmp
(
dictionary
[
i
+
1
],
"Success"
))
{
success
=
1
;
success
=
1
;
}
}
...
@@ -395,7 +395,7 @@ int lockdownd_pair_device(lockdownd_client *control, char *public_key_b64, char
...
@@ -395,7 +395,7 @@ int lockdownd_pair_device(lockdownd_client *control, char *public_key_b64, char
free
(
XML_content
);
free
(
XML_content
);
int
success
=
0
;
int
success
=
0
;
for
(
i
=
0
;
strcmp
(
dictionary
[
i
],
""
)
;
i
+=
2
)
{
for
(
i
=
0
;
dictionary
[
i
]
;
i
+=
2
)
{
if
(
!
strcmp
(
dictionary
[
i
],
"Result"
)
&&
!
strcmp
(
dictionary
[
i
+
1
],
"Success"
))
{
if
(
!
strcmp
(
dictionary
[
i
],
"Result"
)
&&
!
strcmp
(
dictionary
[
i
+
1
],
"Success"
))
{
success
=
1
;
success
=
1
;
}
}
...
@@ -592,7 +592,7 @@ int lockdownd_start_SSL_session(lockdownd_client *control, const char *HostID) {
...
@@ -592,7 +592,7 @@ int lockdownd_start_SSL_session(lockdownd_client *control, const char *HostID) {
dictionary
=
read_dict_element_strings
(
dict
);
dictionary
=
read_dict_element_strings
(
dict
);
xmlFreeDoc
(
plist
);
xmlFreeDoc
(
plist
);
free
(
what2send
);
free
(
what2send
);
for
(
i
=
0
;
strcmp
(
dictionary
[
i
],
""
)
;
i
+=
2
)
{
for
(
i
=
0
;
dictionary
[
i
]
;
i
+=
2
)
{
if
(
!
strcmp
(
dictionary
[
i
],
"Result"
)
&&
!
strcmp
(
dictionary
[
i
+
1
],
"Success"
))
{
if
(
!
strcmp
(
dictionary
[
i
],
"Result"
)
&&
!
strcmp
(
dictionary
[
i
+
1
],
"Success"
))
{
// Set up GnuTLS...
// Set up GnuTLS...
//gnutls_anon_client_credentials_t anoncred;
//gnutls_anon_client_credentials_t anoncred;
...
@@ -650,7 +650,7 @@ int lockdownd_start_SSL_session(lockdownd_client *control, const char *HostID) {
...
@@ -650,7 +650,7 @@ int lockdownd_start_SSL_session(lockdownd_client *control, const char *HostID) {
if
(
debug
)
{
if
(
debug
)
{
printf
(
"Apparently failed negotiating with lockdownd.
\n
"
);
printf
(
"Apparently failed negotiating with lockdownd.
\n
"
);
printf
(
"Responding dictionary:
\n
"
);
printf
(
"Responding dictionary:
\n
"
);
for
(
i
=
0
;
strcmp
(
dictionary
[
i
],
""
)
;
i
+=
2
)
{
for
(
i
=
0
;
dictionary
[
i
]
;
i
+=
2
)
{
printf
(
"
\t
%s: %s
\n
"
,
dictionary
[
i
],
dictionary
[
i
+
1
]);
printf
(
"
\t
%s: %s
\n
"
,
dictionary
[
i
],
dictionary
[
i
+
1
]);
}
}
}
}
...
@@ -814,7 +814,7 @@ int lockdownd_start_service(lockdownd_client *control, const char *service) {
...
@@ -814,7 +814,7 @@ int lockdownd_start_service(lockdownd_client *control, const char *service) {
if
(
!
dict
)
return
0
;
if
(
!
dict
)
return
0
;
dictionary
=
read_dict_element_strings
(
dict
);
dictionary
=
read_dict_element_strings
(
dict
);
for
(
i
=
0
;
strcmp
(
dictionary
[
i
],
""
)
;
i
+=
2
)
{
for
(
i
=
0
;
dictionary
[
i
]
;
i
+=
2
)
{
if
(
debug
)
printf
(
"lockdownd_start_service() dictionary %s: %s
\n
"
,
dictionary
[
i
],
dictionary
[
i
+
1
]);
if
(
debug
)
printf
(
"lockdownd_start_service() dictionary %s: %s
\n
"
,
dictionary
[
i
],
dictionary
[
i
+
1
]);
if
(
!
xmlStrcmp
(
dictionary
[
i
],
"Port"
))
{
if
(
!
xmlStrcmp
(
dictionary
[
i
],
"Port"
))
{
...
...
src/plist.c
View file @
ef6206f5
...
@@ -212,7 +212,7 @@ char **read_dict_element_strings(xmlNode *dict) {
...
@@ -212,7 +212,7 @@ char **read_dict_element_strings(xmlNode *dict) {
old
=
return_me
;
old
=
return_me
;
return_me
=
realloc
(
return_me
,
sizeof
(
char
*
)
*
(
current_length
+
1
));
return_me
=
realloc
(
return_me
,
sizeof
(
char
*
)
*
(
current_length
+
1
));
return_me
[
current_pos
]
=
strdup
(
""
)
;
return_me
[
current_pos
]
=
NULL
;
return
return_me
;
return
return_me
;
}
}
...
@@ -224,11 +224,10 @@ void free_dictionary(char **dictionary) {
...
@@ -224,11 +224,10 @@ void free_dictionary(char **dictionary) {
if
(
!
dictionary
)
return
;
if
(
!
dictionary
)
return
;
for
(
i
=
0
;
strcmp
(
dictionary
[
i
],
""
)
;
i
++
)
{
for
(
i
=
0
;
dictionary
[
i
]
;
i
++
)
{
free
(
dictionary
[
i
]);
free
(
dictionary
[
i
]);
}
}
free
(
dictionary
[
i
]);
free
(
dictionary
);
free
(
dictionary
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment