From 11e85d15f96e25ff9dc462f3c2cd7598b672117e Mon Sep 17 00:00:00 2001 From: Aram Sargsyan Date: Tue, 9 Jan 2024 11:35:11 +0000 Subject: [PATCH] Fix a possible dig/host crash in "NS search" mode When getting a SERVFAIL reply from a query, 'host' tries to start the next query in the lookup's list (also true for 'dig +nofail'). However, when running with the '-C' switch (or +nssearch for 'dig'), all the queries in the lookup start from the beginning, so that logic brings to a crash because of the attempted start of the query which was already started. Don't start the next query in the affected code path when in +nssearch mode. (cherry picked from commit f6658b333e44982d8272799e1577b6872909537f) --- bin/dig/dighost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index a8ae79fc28..5b4dca2774 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -4365,7 +4365,7 @@ recv_done(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region, if (l->current_query == query) { query_detach(&l->current_query); } - if (next != NULL) { + if (next != NULL && (!l->ns_search_only || l->trace_root)) { debug("sending query %p", next); if (l->tcp_mode) { start_tcp(next);