]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix case-sensitivity bug in zone filename token-parsing
authorAram Sargsyan <aram@isc.org>
Mon, 13 Apr 2026 11:38:19 +0000 (11:38 +0000)
committerArаm Sаrgsyаn <aram@isc.org>
Thu, 16 Apr 2026 11:37:02 +0000 (11:37 +0000)
The setfilename() function uses case-insensitive strcasestr() when
matching the possible tokens, but then one of the token parsers
uses case-sensitive INSIST checks which can assert when, for example,
matching '%X' and INSIST only accepts '%x'.

The case-insensitivity is documented, which means it's the parser
that needs to be fixed, not the matcher.

Convert the character to lowercase before checking the token's
validity.

lib/dns/zoneproperties.c

index 96f9d8eef40dde132ba5ce88fdcf0d2fde27d543..a8e415660c5541c819866f15f7960d5d14b28bfd 100644 (file)
@@ -366,7 +366,7 @@ tokenparse_label(const token_names_t *names, const foundtoken_t *token,
        dns_name_copy(dns_rootname, target);
        labels = dns_name_countlabels(names->zonename);
 
-       labeltokidx = token->pos[token->len - 1];
+       labeltokidx = isc_ascii_tolower(token->pos[token->len - 1]);
        if (token->len == 2) {
                /*
                 * %z, %y, %x pattern