]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Revert "qpzone find() function could set foundname incorrectly"
authorMichał Kępień <michal@isc.org>
Tue, 6 May 2025 07:14:18 +0000 (09:14 +0200)
committerMichał Kępień <michal@isc.org>
Tue, 6 May 2025 07:14:18 +0000 (09:14 +0200)
This reverts commit dd1050e938243d07dc4741164884c08f30400ae3.

lib/dns/qpzone.c

index b6a9ccad86b631516b2bd2454fa3b64ea252b8bd..409dd7ce45ed808905d9bdfc04e94ad58c7bab33 100644 (file)
@@ -3365,8 +3365,10 @@ find(dns_db_t *db, const dns_name_t *name, dns_dbversion_t *version,
                if (tresult != DNS_R_CONTINUE) {
                        result = tresult;
                        search.chain.len = i - 1;
-                       dns_name_copy(&n->name, foundname);
                        node = n;
+                       if (foundname != NULL) {
+                               dns_name_copy(&node->name, foundname);
+                       }
                }
        }
 
@@ -3635,20 +3637,12 @@ found:
                /*
                 * We have an exact match for the name, but there are no
                 * active rdatasets in the desired version.  That means that
-                * this node doesn't exist in the desired version.
-                * If there's a node above this one, reassign the
-                * foundname to the parent and treat this as a partial
-                * match.
+                * this node doesn't exist in the desired version, and that
+                * we really have a partial match.
                 */
                if (!wild) {
-                       unsigned int len = search.chain.len - 1;
-                       if (len > 0) {
-                               NODE_UNLOCK(nlock, &nlocktype);
-                               dns_qpchain_node(&search.chain, len - 1, NULL,
-                                                (void **)&node, NULL);
-                               dns_name_copy(&node->name, foundname);
-                               goto partial_match;
-                       }
+                       NODE_UNLOCK(nlock, &nlocktype);
+                       goto partial_match;
                }
        }