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
d5e52dbd
Commit
d5e52dbd
authored
Aug 17, 2008
by
Jonathan Beck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix AFC memory leak and errors (from iphoneclient valgrind analysis).
parent
89f0fd84
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
7 deletions
+14
-7
AFC.c
src/AFC.c
+9
-4
main.c
src/main.c
+5
-3
No files found.
src/AFC.c
View file @
d5e52dbd
...
...
@@ -239,6 +239,7 @@ static int receive_AFC_data(AFClient *client, char **dump_here) {
if
(
param1
==
0
)
{
if
(
debug
)
fprintf
(
stderr
,
"... false alarm, but still
\n
"
);
*
dump_here
=
NULL
;
free
(
r_packet
);
return
0
;
}
else
{
if
(
debug
)
fprintf
(
stderr
,
"Errno %i
\n
"
,
param1
);
}
...
...
@@ -253,6 +254,7 @@ static int receive_AFC_data(AFClient *client, char **dump_here) {
if
(
!
recv_len
&&
r_packet
->
operation
==
AFC_SUCCESS_RESPONSE
)
{
*
dump_here
=
NULL
;
free
(
r_packet
);
return
0
;
}
...
...
@@ -272,7 +274,7 @@ static int receive_AFC_data(AFClient *client, char **dump_here) {
if
(
debug
)
fprintf
(
stderr
,
"receive_AFC_data: mux_recv delivered too much data
\n
"
);
break
;
}
if
(
strstr
(
buffer
,
"CFA6LPAA"
))
{
if
(
bytes
>
7
&&
strstr
(
buffer
,
"CFA6LPAA"
))
{
if
(
debug
)
fprintf
(
stderr
,
"receive_AFC_data: WARNING: there is AFC data in this packet at %ti
\n
"
,
strstr
(
buffer
,
"CFA6LPAA"
)
-
buffer
);
if
(
debug
)
fprintf
(
stderr
,
"receive_AFC_data: the total packet length is %i
\n
"
,
bytes
);
}
...
...
@@ -308,7 +310,7 @@ static char **make_strings_list(char *tokens, int true_length) {
list
[
i
]
=
strdup
(
tokens
+
j
);
j
+=
strlen
(
list
[
i
])
+
1
;
}
list
[
i
]
=
strdup
(
""
)
;
list
[
i
]
=
NULL
;
return
list
;
}
...
...
@@ -455,6 +457,7 @@ int afc_rename_file(AFClient *client, const char *from, const char *to) {
client
->
afc_packet
->
entire_length
=
client
->
afc_packet
->
this_length
=
0
;
client
->
afc_packet
->
operation
=
AFC_RENAME
;
bytes
=
dispatch_AFC_packet
(
client
,
send
,
strlen
(
to
)
+
strlen
(
from
)
+
2
);
free
(
send
);
if
(
bytes
<=
0
)
{
afc_unlock
(
client
);
return
0
;
...
...
@@ -547,7 +550,7 @@ AFCFile *afc_get_file_info(AFClient *client, const char *path) {
// Parse the data
if
(
list
)
{
my_file
=
(
AFCFile
*
)
malloc
(
sizeof
(
AFCFile
));
for
(
i
=
0
;
strcmp
(
list
[
i
],
""
)
;
i
++
)
{
for
(
i
=
0
;
list
[
i
]
;
i
++
)
{
if
(
!
strcmp
(
list
[
i
],
"st_size"
))
{
my_file
->
size
=
atoi
(
list
[
i
+
1
]);
}
...
...
@@ -564,7 +567,7 @@ AFCFile *afc_get_file_info(AFClient *client, const char *path) {
}
}
}
free_dictionary
(
list
);
g_strfreev
(
list
);
return
my_file
;
}
else
{
return
NULL
;
...
...
@@ -618,6 +621,7 @@ AFCFile *afc_open_file(AFClient *client, const char *filename, uint32 file_mode)
// Get the file info and return it
file_infos
=
afc_get_file_info
(
client
,
filename
);
memcpy
(
&
file_infos
->
filehandle
,
data
,
4
);
free
(
data
);
return
file_infos
;
}
else
{
if
(
debug
)
fprintf
(
stderr
,
"afc_open_file: Didn't get any further data
\n
"
);
...
...
@@ -661,6 +665,7 @@ int afc_read_file(AFClient *client, AFCFile *file, char *data, int length) {
client
->
afc_packet
->
operation
=
AFC_READ
;
client
->
afc_packet
->
entire_length
=
client
->
afc_packet
->
this_length
=
0
;
bytes
=
dispatch_AFC_packet
(
client
,
(
char
*
)
packet
,
sizeof
(
AFCFilePacket
));
free
(
packet
);
if
(
bytes
<=
0
)
{
afc_unlock
(
client
);
...
...
src/main.c
View file @
d5e52dbd
...
...
@@ -66,17 +66,18 @@ int main(int argc, char *argv[]) {
dirs
=
afc_get_dir_list
(
afc
,
"/eafaedf"
);
if
(
!
dirs
)
dirs
=
afc_get_dir_list
(
afc
,
"/"
);
printf
(
"Directory time.
\n
"
);
for
(
i
=
0
;
strcmp
(
dirs
[
i
],
""
)
;
i
++
)
{
for
(
i
=
0
;
dirs
[
i
]
;
i
++
)
{
printf
(
"/%s
\n
"
,
dirs
[
i
]);
}
free_dictionary
(
dirs
);
g_strfreev
(
dirs
);
dirs
=
afc_get_devinfo
(
afc
);
if
(
dirs
)
{
for
(
i
=
0
;
strcmp
(
dirs
[
i
],
""
)
;
i
+=
2
)
{
for
(
i
=
0
;
dirs
[
i
]
;
i
+=
2
)
{
printf
(
"%s: %s
\n
"
,
dirs
[
i
],
dirs
[
i
+
1
]);
}
}
g_strfreev
(
dirs
);
AFCFile
*
my_file
=
afc_open_file
(
afc
,
"/iTunesOnTheGoPlaylist.plist"
,
AFC_FILE_READ
);
if
(
my_file
)
{
...
...
@@ -124,6 +125,7 @@ int main(int argc, char *argv[]) {
else
printf
(
"Couldn't read!
\n
"
);
free
(
threeletterword
);
afc_close_file
(
afc
,
my_file
);
free
(
my_file
);
}
afc_disconnect
(
afc
);
...
...
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