diff options
author | Nikias Bassen | 2019-12-09 01:22:26 +0100 |
---|---|---|
committer | Nikias Bassen | 2019-12-09 01:22:26 +0100 |
commit | a511a4bd9ba47ca5d427cde089ba7f0932eb136b (patch) | |
tree | 0d7a6ceeca1aa2e5f6899136842d92e73042125a /src | |
parent | 3763b84509f0d3e80727f26d427c07341c295e03 (diff) | |
download | libplist-a511a4bd9ba47ca5d427cde089ba7f0932eb136b.tar.gz libplist-a511a4bd9ba47ca5d427cde089ba7f0932eb136b.tar.bz2 |
bplist: Add cast to/from uint32_t when reading/storing indices for recursion check
Diffstat (limited to 'src')
-rw-r--r-- | src/bplist.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/bplist.c b/src/bplist.c index 987dd93..ec4ebe2 100644 --- a/src/bplist.c +++ b/src/bplist.c @@ -742,17 +742,17 @@ static plist_t parse_bin_node_at_index(struct bplist_data *bplist, uint32_t node /* store node_index for current recursion level */ if (ptr_array_size(bplist->used_indexes) < bplist->level+1) { while (ptr_array_size(bplist->used_indexes) < bplist->level+1) { - ptr_array_add(bplist->used_indexes, node_index); + ptr_array_add(bplist->used_indexes, (void*)(uintptr_t)node_index); } } else { - ptr_array_set(bplist->used_indexes, node_index, bplist->level); + ptr_array_set(bplist->used_indexes, (void*)(uintptr_t)node_index, bplist->level); } /* recursion check */ if (bplist->level > 0) { for (i = bplist->level-1; i >= 0; i--) { - uint32_t node_i = ptr_array_index(bplist->used_indexes, i); - uint32_t node_level = ptr_array_index(bplist->used_indexes, bplist->level); + uint32_t node_i = (uint32_t)(uintptr_t)ptr_array_index(bplist->used_indexes, i); + uint32_t node_level = (uint32_t)(uintptr_t)ptr_array_index(bplist->used_indexes, bplist->level); if (node_i == node_level) { PLIST_BIN_ERR("recursion detected in binary plist\n"); return NULL; |