Commit 479b9cd696 for bind
commit 479b9cd69694268c897f0c6d339c2733b4d501ca
Author: Aram Sargsyan <aram@isc.org>
Date: Tue Dec 1 20:02:35 2026 +0000
Don't try to get fetch addresses when there is no delegation set
As a defence in depth, don't try to call fctx_getaddresses_addresses()
and fctx_getaddresses_nameservers() when the fetch context's delegation
set is unset.
If a siutation like this happens, no addresses will be found and the
fetch will fail gracefully with "no addresses" logged instead of a
crash.
diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c
index a9565657a5..c4700e5e74 100644
--- a/lib/dns/resolver.c
+++ b/lib/dns/resolver.c
@@ -3950,23 +3950,25 @@ fctx_getaddresses(fetchctx_t *fctx) {
* `fctx_getaddresses_nameservers`.
* */
- fctx_getaddresses_addresses(fctx, now, stdoptions, &all_spilled,
- &ns_processed);
+ if (fctx->delegset != NULL) {
+ fctx_getaddresses_addresses(fctx, now, stdoptions, &all_spilled,
+ &ns_processed);
- fetches_allowed = fctx_getaddresses_allowed(fctx);
+ fetches_allowed = fctx_getaddresses_allowed(fctx);
- result = fctx_getaddresses_nameservers(fctx, now, stdoptions,
- fetches_allowed, &need_alternate,
- &all_spilled, &ns_processed);
- if (result == DNS_R_CONTINUE && fetches_allowed == 0) {
- /*
- * We have no addresses and we haven't allowed any
- * fetches to be started. Allow one extra fetch and try
- * again.
- */
- (void)fctx_getaddresses_nameservers(
- fctx, now, stdoptions, 1, &need_alternate, &all_spilled,
- &ns_processed);
+ result = fctx_getaddresses_nameservers(
+ fctx, now, stdoptions, fetches_allowed, &need_alternate,
+ &all_spilled, &ns_processed);
+ if (result == DNS_R_CONTINUE && fetches_allowed == 0) {
+ /*
+ * We have no addresses and we haven't allowed any
+ * fetches to be started. Allow one extra fetch and try
+ * again.
+ */
+ (void)fctx_getaddresses_nameservers(
+ fctx, now, stdoptions, 1, &need_alternate,
+ &all_spilled, &ns_processed);
+ }
}
/*