Hi,all:

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 3.3.3.0/24 and 3.3.0.0/16.If we call isc_radix_search with a isc_prefix_t set as 3.3.3.3/22, 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),
                                    isc_prefix_tochar(prefix),
                                    node->prefix->bitlen)) {


--
Best Regards.
Tom Sawyer.