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
8e51cdc2
Commit
8e51cdc2
authored
Feb 05, 2017
by
Nikias Bassen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bplist: Make sure the offset table is in the correct range
parent
2c44cd6e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
bplist.c
src/bplist.c
+9
-4
No files found.
src/bplist.c
View file @
8e51cdc2
...
@@ -679,7 +679,9 @@ PLIST_API void plist_from_bin(const char *plist_bin, uint32_t length, plist_t *
...
@@ -679,7 +679,9 @@ PLIST_API void plist_from_bin(const char *plist_bin, uint32_t length, plist_t *
uint8_t
ref_size
=
0
;
uint8_t
ref_size
=
0
;
uint64_t
num_objects
=
0
;
uint64_t
num_objects
=
0
;
uint64_t
root_object
=
0
;
uint64_t
root_object
=
0
;
char
*
offset_table
=
NULL
;
const
char
*
offset_table
=
NULL
;
const
char
*
start_data
=
NULL
;
const
char
*
end_data
=
NULL
;
//first check we have enough data
//first check we have enough data
if
(
!
(
length
>=
BPLIST_MAGIC_SIZE
+
BPLIST_VERSION_SIZE
+
sizeof
(
bplist_trailer_t
)))
if
(
!
(
length
>=
BPLIST_MAGIC_SIZE
+
BPLIST_VERSION_SIZE
+
sizeof
(
bplist_trailer_t
)))
...
@@ -691,8 +693,11 @@ PLIST_API void plist_from_bin(const char *plist_bin, uint32_t length, plist_t *
...
@@ -691,8 +693,11 @@ PLIST_API void plist_from_bin(const char *plist_bin, uint32_t length, plist_t *
if
(
memcmp
(
plist_bin
+
BPLIST_MAGIC_SIZE
,
BPLIST_VERSION
,
BPLIST_VERSION_SIZE
)
!=
0
)
if
(
memcmp
(
plist_bin
+
BPLIST_MAGIC_SIZE
,
BPLIST_VERSION
,
BPLIST_VERSION_SIZE
)
!=
0
)
return
;
return
;
start_data
=
plist_bin
+
BPLIST_MAGIC_SIZE
+
BPLIST_VERSION_SIZE
;
end_data
=
plist_bin
+
length
-
sizeof
(
bplist_trailer_t
);
//now parse trailer
//now parse trailer
trailer
=
(
bplist_trailer_t
*
)
(
plist_bin
+
(
length
-
sizeof
(
bplist_trailer_t
)))
;
trailer
=
(
bplist_trailer_t
*
)
end_data
;
offset_size
=
trailer
->
offset_size
;
offset_size
=
trailer
->
offset_size
;
ref_size
=
trailer
->
ref_size
;
ref_size
=
trailer
->
ref_size
;
...
@@ -712,10 +717,10 @@ PLIST_API void plist_from_bin(const char *plist_bin, uint32_t length, plist_t *
...
@@ -712,10 +717,10 @@ PLIST_API void plist_from_bin(const char *plist_bin, uint32_t length, plist_t *
if
(
root_object
>=
num_objects
)
if
(
root_object
>=
num_objects
)
return
;
return
;
if
(
offset_table
<
plist_bin
||
offset_table
>=
plist_bin
+
length
)
if
(
offset_table
<
start_data
||
offset_table
>=
end_data
)
return
;
return
;
if
(
offset_table
+
num_objects
*
offset_size
>
=
plist_bin
+
length
)
if
(
offset_table
+
num_objects
*
offset_size
>
end_data
)
return
;
return
;
struct
bplist_data
bplist
;
struct
bplist_data
bplist
;
...
...
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