]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Consistently set specials[0] to 1
authorMark Andrews <marka@isc.org>
Wed, 11 Mar 2026 22:23:00 +0000 (09:23 +1100)
committerEvan Hunt <each@isc.org>
Thu, 9 Apr 2026 01:25:12 +0000 (18:25 -0700)
NULs in text files indicate corruption.  Additionally embedded NULs
can cause text files to be interpreted differently to the way they
appear to be when read by humans.  We addressed this for zone files
in 4bf686cf, by setting specials[0] to 1, where a corrupted zone
file was interpreted differently to the way it read.  We should
have applied this to other places where we read text files at that
time.  We are now applying this to

bin/dnssec/dnssec-ksr.c.
bin/tools/named-rrchecker.c
lib/dns/dst_api.c
lib/dns/skr.c
lib/isccfg/parser.c

We should also apply this consistently to all code that mimics
reading text files to prevent false negatives like that reported
in #5796.  e.g. fuzz/dns_rdata_fromtext.c

bin/dnssec/dnssec-ksr.c
bin/tools/named-rrchecker.c
fuzz/dns_rdata_fromtext.c
lib/dns/dst_api.c
lib/dns/skr.c
lib/isccfg/parser.c

index d2a387290906557accb857b622a348415803c9c1..5088bb7d7e490af68499fbe7eff512e1d6e56bb4 100644 (file)
@@ -1150,6 +1150,7 @@ sign(ksr_ctx_t *ksr) {
        inception = ksr->start;
        isc_lex_create(isc_g_mctx, KSR_LINESIZE, &lex);
        memset(specials, 0, sizeof(specials));
+       specials[0] = 1;
        specials['('] = 1;
        specials[')'] = 1;
        specials['"'] = 1;
index 99a0ba4dface5bef3d21453ac559aeec0411b45d..28bbea39ab58c8af34b80ec52291385d02001cf2 100644 (file)
@@ -172,6 +172,7 @@ main(int argc, char *argv[]) {
         * Set up to lex DNS master file.
         */
 
+       specials[0] = 1;
        specials['('] = 1;
        specials[')'] = 1;
        specials['"'] = 1;
index a8ee8949b14be4be645f706673ba623fe30f6a4c..68c6894a30629d9cd5e93cde3e608f266a592967 100644 (file)
@@ -41,7 +41,7 @@ LLVMFuzzerInitialize(int *argc, char ***argv) {
 }
 
 /* following code was copied from named-rrchecker */
-isc_lexspecials_t specials = { ['('] = 1, [')'] = 1, ['"'] = 1 };
+isc_lexspecials_t specials = { [0] = 1, ['('] = 1, [')'] = 1, ['"'] = 1 };
 
 int
 LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
index b8b673043b27ff9d4fe8eadec1458bac821abf9c..87480529b065b03a3ddd1925e1f5e4dad732121d 100644 (file)
@@ -1490,6 +1490,7 @@ dst_key_read_public(const char *filename, int type, isc_mem_t *mctx,
        isc_lex_create(mctx, 1500, &lex);
 
        memset(specials, 0, sizeof(specials));
+       specials[0] = 1;
        specials['('] = 1;
        specials[')'] = 1;
        specials['"'] = 1;
index a54b843fc272849d3ef5166b836762932d3d8f4c..0b3b043513239ab0a0337b48ba8ab067c71c499d 100644 (file)
@@ -225,6 +225,7 @@ dns_skr_read(isc_mem_t *mctx, const char *filename, dns_name_t *origin,
 
        isc_lex_create(mctx, TOKENSIZ, &lex);
        memset(specials, 0, sizeof(specials));
+       specials[0] = 1;
        specials['('] = 1;
        specials[')'] = 1;
        specials['"'] = 1;
index 83722cb858f4827ead7c5952086fdcd076b6c626..188919f14f76f8fa2019e07a09b7f91e50f4ecb1 100644 (file)
@@ -698,6 +698,7 @@ parser_create(cfg_parser_t **ret) {
        pctx->buf_name = NULL;
 
        memset(specials, 0, sizeof(specials));
+       specials[0] = 1;
        specials['{'] = 1;
        specials['}'] = 1;
        specials[';'] = 1;