Fix UAF io bank map deletion

This commit is contained in:
condret 2021-10-25 15:06:20 +02:00
parent 04998a7135
commit 5f25da4d37
2 changed files with 7 additions and 4 deletions

View File

@ -884,6 +884,7 @@ R_API void r_io_bank_del_map(RIO *io, const ut32 bankid, const ut32 mapid) {
break;
}
}
bank->last_used = NULL;
// map is not referenced by this bank; nothing to do
}

View File

@ -352,10 +352,12 @@ R_API bool r_crbtree_delete(RRBTree *tree, void *data, RRBComparator cmp, void *
free (q);
#else
_set_link (p, q->link[q->link[0] == NULL], p->link[1] == q);
q->link[0] = NULL;
q->link[1] = NULL;
q->parent = NULL;
_exchange_nodes (found, q);
if (q != found) {
q->link[0] = NULL;
q->link[1] = NULL;
q->parent = NULL;
_exchange_nodes (found, q);
}
if (tree->free) {
tree->free (found->data);
}