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
4750a54d
Commit
4750a54d
authored
Aug 04, 2008
by
Matt Colyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added ability to get files larger than a single USB packet size.
parent
579ca1bd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
8 deletions
+22
-8
AFC.c
src/AFC.c
+22
-8
No files found.
src/AFC.c
View file @
4750a54d
...
...
@@ -21,6 +21,9 @@
#include "AFC.h"
// This is the maximum size an AFC data packet can be
const
int
MAXIMUM_PACKET_SIZE
=
(
2
<<
15
)
-
32
;
extern
int
debug
;
AFClient
*
afc_connect
(
iPhone
*
phone
,
int
s_port
,
int
d_port
)
{
...
...
@@ -121,7 +124,8 @@ int dispatch_AFC_packet(AFClient *client, char *data, int length) {
int
receive_AFC_data
(
AFClient
*
client
,
char
**
dump_here
)
{
AFCPacket
*
r_packet
;
char
*
buffer
=
(
char
*
)
malloc
(
sizeof
(
AFCPacket
)
*
4
);
int
bytes
=
0
,
recv_len
=
0
;
char
*
final_buffer
=
NULL
;
int
bytes
=
0
,
recv_len
=
0
,
current_count
=
0
;
int
retval
=
0
;
bytes
=
mux_recv
(
client
->
phone
,
client
->
connection
,
buffer
,
sizeof
(
AFCPacket
)
*
4
);
...
...
@@ -164,17 +168,27 @@ int receive_AFC_data(AFClient *client, char **dump_here) {
recv_len
=
r_packet
->
entire_length
-
r_packet
->
this_length
;
free
(
r_packet
);
if
(
!
recv_len
)
return
bytes
;
buffer
=
(
char
*
)
malloc
(
sizeof
(
char
)
*
recv_len
);
bytes
=
mux_recv
(
client
->
phone
,
client
->
connection
,
buffer
,
recv_len
);
if
(
bytes
<=
0
)
{
free
(
buffer
);
// Keep collecting packets until we have received the entire file.
buffer
=
(
char
*
)
malloc
(
sizeof
(
char
)
*
(
recv_len
<
MAXIMUM_PACKET_SIZE
)
?
recv_len
:
MAXIMUM_PACKET_SIZE
);
final_buffer
=
(
char
*
)
malloc
(
sizeof
(
char
)
*
recv_len
);
while
(
current_count
<
recv_len
){
bytes
=
mux_recv
(
client
->
phone
,
client
->
connection
,
buffer
,
recv_len
);
if
(
bytes
<
0
)
break
;
memcpy
(
final_buffer
+
current_count
,
buffer
,
bytes
);
current_count
+=
bytes
;
}
free
(
buffer
);
/*if (bytes <= 0) {
free(final_buffer);
printf("Didn't get it at the second pass.\n");
*dump_here = NULL;
return 0;
}
}
*/
*
dump_here
=
buffer
;
// what they do beyond this point = not my problem
return
bytes
;
*
dump_here
=
final_
buffer
;
// what they do beyond this point = not my problem
return
current_count
;
}
char
**
afc_get_dir_list
(
AFClient
*
client
,
char
*
dir
)
{
...
...
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