[9.18] fix: usr: Remove unnecessary dns_name_free call

When processing a catalog zone member's primaries definition and
there is a TXT record containing an invalid name TSIG key name,
dns_name_free was incorrectly called triggering an assertion.
This has been fixed.

Closes #5858

Backport of MR !11832

Merge branch 'backport-5858-remove-unnecessary-dns-name-free-call-9.18' into 'bind-9.18'

See merge request isc-projects/bind9!11849
This commit is contained in:
Mark Andrews 2026-04-15 13:46:45 +10:00
commit 46aa4fd08d
5 changed files with 33 additions and 1 deletions

View file

@ -0,0 +1,7 @@
@ 3600 SOA . . 1 86400 3600 86400 3600
@ 3600 IN NS invalid.
version IN TXT "2"
deadbeef.zones IN PTR member.example.
mykey.primaries.ext.deadbeef.zones IN A 192.0.2.1
; bad key name label too big
mykey.primaries.ext.deadbeef.zones IN TXT "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.example.com"

View file

@ -108,6 +108,16 @@ view "default" {
notify explicit;
};
# Bad TSIG key name
zone "catalog-bad6.example" {
type primary;
file "catalog-bad6.example.db";
allow-transfer { any; };
allow-update { any; };
also-notify { 10.53.0.2; };
notify explicit;
};
# A catalog zone that requires TLS to be used
zone "catalog-tls.example" {
type primary;

View file

@ -67,6 +67,10 @@ view "default" {
zone "catalog-bad4.example"
default-masters { 10.53.0.1; }
in-memory yes;
zone "catalog-bad6.example"
default-masters { 10.53.0.1; }
min-update-interval 1s
in-memory yes;
};
# A faulty dlz configuration to check if named and catz survive a certain class
@ -155,6 +159,12 @@ view "default" {
primaries { 10.53.0.1; };
};
# Bad TSIG key name
zone "catalog-bad6.example" {
type secondary;
file "catalog-bad6.example.db";
primaries { 10.53.0.1; };
};
};
view "ch" ch {

View file

@ -126,6 +126,12 @@ grep -F "catz: dns_catz_add_zone catalog-bad5.example" ns2/named.run && ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status + ret))
echo_i "checking that catalog-bad6.example (invalid TSIG key name) is handled ($n)"
ret=0
wait_for_message ns2/named.run "catz: invalid record in catalog zone - mykey.primaries.ext.deadbeef.zones.catalog-bad6.example IN TXT (label too long) - ignoring" || ret=1
if [ $ret -ne 0 ]; then echo_i "failed"; fi
status=$((status + ret))
nextpart ns2/named.run >/dev/null
##########################################################################

View file

@ -1469,7 +1469,6 @@ catz_process_primaries(dns_catz_zone_t *catz, dns_ipkeylist_t *ipkl,
dns_rdata_freestruct(&rdata_txt);
result = dns_name_fromstring(keyname, keycbuf, 0, mctx);
if (result != ISC_R_SUCCESS) {
dns_name_free(keyname, mctx);
isc_mem_put(mctx, keyname, sizeof(*keyname));
return result;
}