summaryrefslogtreecommitdiffstats
path: root/src/bplist.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bplist.c')
-rw-r--r--src/bplist.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/bplist.c b/src/bplist.c
index 308b787..1187c7a 100644
--- a/src/bplist.c
+++ b/src/bplist.c
@@ -852,7 +852,13 @@ static plist_t parse_bin_node_at_index(struct bplist_data *bplist, uint32_t node
852 return NULL; 852 return NULL;
853 } 853 }
854 854
855 ptr = bplist->data + UINT_TO_HOST(idx_ptr, bplist->offset_size); 855 uint64_t node_offset = UINT_TO_HOST(idx_ptr, bplist->offset_size);
856 if (node_offset > (uint64_t)bplist->size) {
857 PLIST_BIN_ERR("node offset overflow (%llu)\n", node_offset);
858 bplist->err = PLIST_ERR_PARSE;
859 return NULL;
860 }
861 ptr = bplist->data + node_offset;
856 /* make sure the node offset is in a sane range */ 862 /* make sure the node offset is in a sane range */
857 if ((ptr < bplist->data+BPLIST_MAGIC_SIZE+BPLIST_VERSION_SIZE) || (ptr >= bplist->offset_table)) { 863 if ((ptr < bplist->data+BPLIST_MAGIC_SIZE+BPLIST_VERSION_SIZE) || (ptr >= bplist->offset_table)) {
858 PLIST_BIN_ERR("offset for node index %u points outside of valid range\n", node_index); 864 PLIST_BIN_ERR("offset for node index %u points outside of valid range\n", node_index);