]> git.ipfire.org Git - thirdparty/bind9.git/commit
fix another dns_qp_lookup() iterator bug
authorEvan Hunt <each@isc.org>
Mon, 4 Dec 2023 19:21:40 +0000 (11:21 -0800)
committerEvan Hunt <each@isc.org>
Wed, 6 Dec 2023 19:03:30 +0000 (11:03 -0800)
commit60a33ae6bb7ecdb59aaf78e8806c9ec129563765
tree4a030728f03309eb64edacf97c76f5c2cfaf4434
parent861290247615f66a5d0c2804c4c51a940a6047f1
fix another dns_qp_lookup() iterator bug

there was another edge case in which an iterator could be positioned at
the wrong node after dns_qp_lookup().  when searching for a key, it's
possible to reach a dead-end branch that doesn't match, because the
branch offset point is *after* the point where the search key differs
from the branch's contents.

for example, if searching for the key "mop", we could reach a branch
containing "moon" and "moor". the branch offset point - i.e., the
point after which the branch's leaves differ from each other - is the
fourth character ("n" or "r"). however, both leaves differ from the
search key at position *three* ("o" or "p"). the old code failed to
detect this condition, and would have incorrectly left the iterator
pointing at some lower value and not at "moor".

this has been fixed and the unit test now includes this scenario.
lib/dns/qp.c
tests/dns/qp_test.c