]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[v9_6] assertion failure in resolver.c
authorEvan Hunt <each@isc.org>
Tue, 4 Jun 2013 18:23:39 +0000 (11:23 -0700)
committerEvan Hunt <each@isc.org>
Tue, 4 Jun 2013 18:23:39 +0000 (11:23 -0700)
3584. [security] Caching data from an incompletely signed zone could
trigger an assertion failure in resolver.c [RT #33690]
(cherry picked from commit 276457f7a38f56a5f762238ab89bb45e27948af6)

CHANGES
lib/dns/resolver.c

diff --git a/CHANGES b/CHANGES
index 0767cc7d3a1c85e1f9d7191861450b478cd75070..a4d8b80c0e234a523b74fbe8188738c3a89957cb 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+3584.  [security]      Caching data from an incompletely signed zone could
+                       trigger an assertion failure in resolver.c [RT #33690]
+
 3583.  [bug]           Address memory leak in GSS-API processing [RT #33574]
 
 3581.  [bug]           Changed the tcp-listen-queue default to 10. [RT #33029]
index d46091189c8eb3e4b8d148276cf235b3871cd3a7..3d395f44eb203403658baebedfed81bd091b9ffa 100644 (file)
@@ -4372,7 +4372,7 @@ fctx_log(void *arg, int level, const char *fmt, ...) {
 
 static inline isc_result_t
 findnoqname(fetchctx_t *fctx, dns_name_t *name, dns_rdatatype_t type,
-           dns_name_t **noqname)
+           dns_name_t **noqnamep)
 {
        dns_rdataset_t *nrdataset, *next, *sigrdataset;
        dns_rdata_rrsig_t rrsig;
@@ -4385,10 +4385,12 @@ findnoqname(fetchctx_t *fctx, dns_name_t *name, dns_rdatatype_t type,
        dns_fixedname_t fclosest;
        dns_name_t *nearest;
        dns_fixedname_t fnearest;
+       dns_rdatatype_t found = dns_rdatatype_none;
+       dns_name_t *noqname = NULL;
 
        FCTXTRACE("findnoqname");
 
-       REQUIRE(noqname != NULL && *noqname == NULL);
+       REQUIRE(noqnamep != NULL && *noqnamep == NULL);
 
        /*
         * Find the SIG for this rdataset, if we have it.
@@ -4457,8 +4459,10 @@ findnoqname(fetchctx_t *fctx, dns_name_t *name, dns_rdatatype_t type,
                                                        &data, NULL, fctx_log,
                                                        fctx)))
                        {
-                               if (!exists)
-                                       *noqname = nsec;
+                               if (!exists) {
+                                       noqname = nsec;
+                                       found = dns_rdatatype_nsec;
+                               }
                        }
 
                        if (nrdataset->type == dns_rdatatype_nsec3 &&
@@ -4471,13 +4475,26 @@ findnoqname(fetchctx_t *fctx, dns_name_t *name, dns_rdatatype_t type,
                                                         closest, nearest,
                                                         fctx_log, fctx)))
                        {
-                               if (!exists && setnearest)
-                                       *noqname = nsec;
+                               if (!exists && setnearest) {
+                                       noqname = nsec;
+                                       found = dns_rdatatype_nsec3;
+                               }
                        }
                }
        }
        if (result == ISC_R_NOMORE)
                result = ISC_R_SUCCESS;
+       if (noqname != NULL) {
+               for (sigrdataset = ISC_LIST_HEAD(noqname->list);
+                    sigrdataset != NULL;
+                    sigrdataset = ISC_LIST_NEXT(sigrdataset, link)) {
+                       if (sigrdataset->type == dns_rdatatype_rrsig &&
+                           sigrdataset->covers == found)
+                               break;
+               }
+               if (sigrdataset != NULL)
+                       *noqnamep = noqname;
+       }
        return (result);
 }