Bug report: unexpected behavior in isc_radix_search

Tom Sawyer tomsawyer126 at gmail.com
Mon Nov 3 02:32:26 UTC 2014


I possibly find a bug exist in isc_radix_search(lib/isc/radix.c),
bind-9.10.1 .

Suppose we have two radix nodes a and b in a radix tree. Their prefix is and we call isc_radix_search with a isc_prefix_t
set as, it will return success with node a. But for the
definition of radix_tree it should be node b to be found.

The reason of this behavior hasn't been exposed is that isc_radix_search is
called with a prefix set as x.x.x.x/32(Ipv4) for now.

Patch is as follows and it is suit for bind-9.10.1 :

diff --git i/lib/isc/radix.c w/lib/isc/radix.c
index df26615..6f9cc19 100644
--- i/lib/isc/radix.c
+++ w/lib/isc/radix.c
@@ -279,6 +279,9 @@ isc_radix_search(isc_radix_tree_t *radix,
isc_radix_node_t **target,
        while (cnt-- > 0) {
                node = stack[cnt];

+              if (prefix->bitlen < node->bit){
+                   continue;
+              }
                if (_comp_with_mask(isc_prefix_tochar(node->prefix),
                                    node->prefix->bitlen)) {

Best Regards.
Tom Sawyer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/mailman/private/bind-workers/attachments/20141103/5152517d/attachment.html>

More information about the bind-workers mailing list