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 f6658b333e)
This commit is contained in:
Aram Sargsyan
2024-01-09 11:35:11 +00:00
parent 5274bba746
commit 11e85d15f9

View File

@@ -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);