]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
pullup (inspected by halley)
authorAndreas Gustafsson <source@isc.org>
Tue, 1 May 2001 20:33:12 +0000 (20:33 +0000)
committerAndreas Gustafsson <source@isc.org>
Tue, 1 May 2001 20:33:12 +0000 (20:33 +0000)
 818.   [bug]           Certain pathological responses to ANY queries could
                        cause an assertion failure. [RT #1218]

CHANGES
bin/named/query.c

diff --git a/CHANGES b/CHANGES
index d20af61069add249f748c27769914086e5ad013a..fe4df3a049530346ddbd78954a0d2cfd93f850f0 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,7 @@
 
+ 818.  [bug]           Certain pathological responses to ANY queries could
+                       cause an assertion failure. [RT #1218]
+
  816.  [bug]           Report potential problems with log file accessibility
                        at configuration time, since such problems can't
                        reliably be reported at the time they actually occur.
index 9bd480856aa96f9ca5b8bc605213af083ba0b56c..73d407741bb2f2028f6352110de8784c923885de 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: query.c,v 1.163.2.4 2001/03/20 18:50:39 gson Exp $ */
+/* $Id: query.c,v 1.163.2.5 2001/05/01 20:33:12 gson Exp $ */
 
 #include <config.h>
 
@@ -3063,20 +3063,24 @@ query_find(ns_client_t *client, dns_fetchevent_t *event) {
                 * cleanup fname even though we're using it!
                 */
                query_keepname(client, fname, dbuf);
+               tname = fname;
                result = dns_rdatasetiter_first(rdsiter);
                while (result == ISC_R_SUCCESS) {
                        dns_rdatasetiter_current(rdsiter, rdataset);
                        if ((qtype == dns_rdatatype_any ||
                             rdataset->type == qtype) && rdataset->type != 0) {
-                               tname = fname;
-                               query_addrrset(client, &tname, &rdataset, NULL,
+                               query_addrrset(client,
+                                              fname != NULL ? &fname : &tname,
+                                              &rdataset, NULL,
                                               NULL, DNS_SECTION_ANSWER);
                                n++;
+                               INSIST(tname != NULL);
                                /*
-                                * We shouldn't ever fail to add 'rdataset'
-                                * because it's already in the answer.
+                                * rdataset is non-NULL only in certain pathological
+                                * cases involving DNAMEs.
                                 */
-                               INSIST(rdataset == NULL);
+                               if (rdataset != NULL)
+                                       query_putrdataset(client, &rdataset);
                                rdataset = query_newrdataset(client);
                                if (rdataset == NULL)
                                        break;
@@ -3088,17 +3092,14 @@ query_find(ns_client_t *client, dns_fetchevent_t *event) {
                        }
                        result = dns_rdatasetiter_next(rdsiter);
                }
-               if (n > 0) {
-                       /*
-                        * As mentioned above, we must now clear fname
-                        * since we're using it.
-                        */
-                       fname = NULL;
-               } else {
+
+               if (fname != NULL)
+                       dns_message_puttempname(client->message, &fname);
+
+               if (n == 0) {
                        /*
                         * We didn't match any rdatasets.
                         */
-                       dns_message_puttempname(client->message, &fname);
                        if (qtype == dns_rdatatype_sig &&
                            result == ISC_R_NOMORE) {
                                /*