]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Guard against NULL delegset in query_delegation_recurse()
authorOndřej Surý <ondrej@isc.org>
Sat, 14 Mar 2026 07:20:43 +0000 (08:20 +0100)
committerColin Vidal <colin@isc.org>
Mon, 30 Mar 2026 18:41:13 +0000 (20:41 +0200)
If both dns_view_bestzonecut() and dns_deleg_fromrdataset() fail,
delegset stays NULL.  Passing it to ns_query_recurse() would crash
on the REQUIRE(DNS_DELEGSET_VALID(delegset)) in createfetch().

Return ISC_R_NOTFOUND instead, which lets the caller handle the
failure gracefully.

lib/ns/query.c

index b25b37c91f60d1f8e34514fbd8b4aaabc22504ab..f9f43b363c3f495a19c530159ef149dbc6c49365 100644 (file)
@@ -8670,8 +8670,13 @@ query_delegation_recurse(query_ctx_t *qctx) {
                        fname = qctx->fname;
                }
 
-               result = ns_query_recurse(qctx->client, qctx->qtype, qname,
-                                         fname, delegset, qctx->resuming);
+               if (delegset == NULL) {
+                       result = ISC_R_NOTFOUND;
+               } else {
+                       result = ns_query_recurse(qctx->client, qctx->qtype,
+                                                 qname, fname, delegset,
+                                                 qctx->resuming);
+               }
 
                if (delegset != NULL) {
                        dns_delegset_detach(&delegset);