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
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;
* Set up to lex DNS master file.
*/
+ specials[0] = 1;
specials['('] = 1;
specials[')'] = 1;
specials['"'] = 1;
}
/* 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) {
isc_lex_create(mctx, 1500, &lex);
memset(specials, 0, sizeof(specials));
+ specials[0] = 1;
specials['('] = 1;
specials[')'] = 1;
specials['"'] = 1;
isc_lex_create(mctx, TOKENSIZ, &lex);
memset(specials, 0, sizeof(specials));
+ specials[0] = 1;
specials['('] = 1;
specials[')'] = 1;
specials['"'] = 1;
pctx->buf_name = NULL;
memset(specials, 0, sizeof(specials));
+ specials[0] = 1;
specials['{'] = 1;
specials['}'] = 1;
specials[';'] = 1;