summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/bplist.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/bplist.c b/src/bplist.c
index be82b4e..49d29c5 100644
--- a/src/bplist.c
+++ b/src/bplist.c
@@ -742,6 +742,9 @@ PLIST_API void plist_from_bin(const char *plist_bin, uint32_t length, plist_t *
if (offset_table + num_objects * offset_size >= plist_bin + length)
return;
+ if (sizeof(uint32_t) * num_objects < num_objects)
+ return;
+
struct bplist_data bplist;
bplist.data = plist_bin;
bplist.size = length;
@@ -752,6 +755,9 @@ PLIST_API void plist_from_bin(const char *plist_bin, uint32_t length, plist_t *
bplist.level = 0;
bplist.used_indexes = (uint32_t*)malloc(sizeof(uint32_t) * num_objects);
+ if (!bplist.used_indexes)
+ return;
+
*plist = parse_bin_node_at_index(&bplist, root_object);
free(bplist.used_indexes);