diff options
| -rw-r--r-- | src/bplist.c | 6 |
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 * | |||
| 742 | if (offset_table + num_objects * offset_size >= plist_bin + length) | 742 | if (offset_table + num_objects * offset_size >= plist_bin + length) |
| 743 | return; | 743 | return; |
| 744 | 744 | ||
| 745 | if (sizeof(uint32_t) * num_objects < num_objects) | ||
| 746 | return; | ||
| 747 | |||
| 745 | struct bplist_data bplist; | 748 | struct bplist_data bplist; |
| 746 | bplist.data = plist_bin; | 749 | bplist.data = plist_bin; |
| 747 | bplist.size = length; | 750 | bplist.size = length; |
| @@ -752,6 +755,9 @@ PLIST_API void plist_from_bin(const char *plist_bin, uint32_t length, plist_t * | |||
| 752 | bplist.level = 0; | 755 | bplist.level = 0; |
| 753 | bplist.used_indexes = (uint32_t*)malloc(sizeof(uint32_t) * num_objects); | 756 | bplist.used_indexes = (uint32_t*)malloc(sizeof(uint32_t) * num_objects); |
| 754 | 757 | ||
| 758 | if (!bplist.used_indexes) | ||
| 759 | return; | ||
| 760 | |||
| 755 | *plist = parse_bin_node_at_index(&bplist, root_object); | 761 | *plist = parse_bin_node_at_index(&bplist, root_object); |
| 756 | 762 | ||
| 757 | free(bplist.used_indexes); | 763 | free(bplist.used_indexes); |
