Subject: | Bug report: unexpected behavior in isc_radix_search |
Date: | Mon, 03 Nov 2014 13:48:09 +1100 |
To: | bind9-bugs@isc.org |
From: | Mark Andrews <marka@isc.org> |
Subject: | Bug report: unexpected behavior in isc_radix_search |
Date: | Mon, 3 Nov 2014 10:32:26 +0800 |
To: | bind-workers@isc.org |
From: | Tom Sawyer <tomsawyer126@gmail.com> |
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.
_______________________________________________
bind-workers mailing list
bind-workers@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-workers