1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-31 20:09:02 +00:00

Paranoid gh_list check: node is in list before removal

This commit is contained in:
dmiller
2024-11-13 19:15:11 +00:00
parent 3f64103cf0
commit 222add87a6

View File

@@ -210,6 +210,15 @@ static inline gh_lnode_t *gh_list_pop(gh_list_t *list) {
static inline int gh_list_remove(gh_list_t *list, gh_lnode_t *lnode) {
paranoid_list_check(list);
#if GH_LIST_PARANOID
gh_lnode_t *cur;
for (cur = list->first; cur != list->last; cur = cur->next) {
if (cur == lnode)
break;
}
assert(cur == lnode);
#endif
if (lnode->prev) {
lnode->prev->next = lnode->next;
} else {