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
b937059c
Commit
b937059c
authored
8 years ago
by
Nikias Bassen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bplist: Improve writing of UID nodes
parent
962d4064
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
12 deletions
+6
-12
bplist.c
src/bplist.c
+6
-12
No files found.
src/bplist.c
View file @
b937059c
...
@@ -1009,22 +1009,16 @@ static void write_dict(bytearray_t * bplist, node_t* node, hashtable_t* ref_tabl
...
@@ -1009,22 +1009,16 @@ static void write_dict(bytearray_t * bplist, node_t* node, hashtable_t* ref_tabl
static
void
write_uid
(
bytearray_t
*
bplist
,
uint64_t
val
)
static
void
write_uid
(
bytearray_t
*
bplist
,
uint64_t
val
)
{
{
val
=
(
uint32_t
)
val
;
val
=
(
uint32_t
)
val
;
uint64_
t
size
=
get_needed_bytes
(
val
);
in
t
size
=
get_needed_bytes
(
val
);
uint8_t
*
buff
=
NULL
;
uint8_t
sz
;
//do not write 3bytes int node
//do not write 3bytes int node
if
(
size
==
3
)
if
(
size
==
3
)
size
++
;
size
++
;
sz
=
BPLIST_UID
|
(
size
-
1
);
// yes, this is what Apple does...
#ifdef __BIG_ENDIAN__
val
=
be64toh
(
val
);
val
=
val
<<
((
sizeof
(
uint64_t
)
-
size
)
*
8
);
byte_array_append
(
bplist
,
&
sz
,
1
);
#endif
byte_array_append
(
bplist
,
(
uint8_t
*
)
&
val
+
(
8
-
size
),
size
);
buff
=
(
uint8_t
*
)
malloc
(
sizeof
(
uint8_t
)
+
size
);
buff
[
0
]
=
BPLIST_UID
|
(
size
-
1
);
// yes, this is what Apple does...
memcpy
(
buff
+
1
,
&
val
,
size
);
byte_convert
(
buff
+
1
,
size
);
byte_array_append
(
bplist
,
buff
,
sizeof
(
uint8_t
)
+
size
);
free
(
buff
);
}
}
static
int
is_ascii_string
(
char
*
s
,
int
len
)
static
int
is_ascii_string
(
char
*
s
,
int
len
)
...
...
This diff is collapsed.
Click to expand it.
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