diff --git a/CHANGES b/CHANGES index 0046e4e564..599f9cef2d 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +2037. [func] When unlinking the first or last element in a list + check that the list head points to the element to + be unlinked. [RT #15959] + 2036. [bug] 'rndc recursing' could cause trigger a REQUIRE. [RT #16075] diff --git a/lib/bind/include/isc/list.h b/lib/bind/include/isc/list.h index 816709b723..c85c6676b5 100644 --- a/lib/bind/include/isc/list.h +++ b/lib/bind/include/isc/list.h @@ -66,12 +66,16 @@ INSIST(LINKED(elt, link));\ if ((elt)->link.next != NULL) \ (elt)->link.next->link.prev = (elt)->link.prev; \ - else \ + else { \ + INSIST((list).tail == (elt)); \ (list).tail = (elt)->link.prev; \ + } \ if ((elt)->link.prev != NULL) \ (elt)->link.prev->link.next = (elt)->link.next; \ - else \ + else { \ + INSIST((list).head == (elt)); \ (list).head = (elt)->link.next; \ + } \ INIT_LINK_TYPE(elt, link, type); \ } while (0) #define UNLINK(list, elt, link) \