[9.20] fix: usr: Stop delv from aborting on a malformed query name

delv aborts with SIGABRT instead of exiting cleanly when given a query
name that fails wire-format conversion (e.g. a label longer than 63
octets). After this change delv prints the parse error and exits with
a normal failure code.

Closes #5916

Backport of MR !11921

Merge branch 'backport-5916-delv-run-resolve-null-detach-abort-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!11927
This commit is contained in:
Ondřej Surý 2026-04-30 12:08:04 +02:00
commit ca8315bb4d
2 changed files with 15 additions and 1 deletions

View file

@ -1982,7 +1982,9 @@ cleanup:
isc_mem_put(mctx, namelist, sizeof(*namelist));
isc_loopmgr_shutdown(loopmgr);
dns_client_detach(&client);
if (client != NULL) {
dns_client_detach(&client);
}
}
static void

View file

@ -1428,6 +1428,18 @@ if [ -x "$DELV" ]; then
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status + ret))
n=$((n + 1))
echo_i "checking delv exits cleanly on malformed query name ($n)"
ret=0
longlabel="$(printf 'a%.0s' $(seq 1 64))"
delv_with_opts @10.53.0.3 -t a "$longlabel.example.com" >delv.out.test$n 2>&1
rc=$?
# Pre-fix: SIGABRT (exit 134) from dns_client_detach(NULL) in run_resolve cleanup.
[ $rc -eq 134 ] && ret=1
grep "label too long" delv.out.test$n >/dev/null || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status + ret))
n=$((n + 1))
echo_i "checking delv with IPv6 on IPv4 does not work ($n)"
if testsock6 fd92:7065:b8e:ffff::3 2>/dev/null; then