bind9/bin/tools
Michal Nowak 8b925266bc Validate nsec3hash arguments instead of relying on atoi()
The nsec3hash tool parsed its algorithm, flags, and iterations
arguments with atoi(), then range-checked the result. For values
that overflow int during digit-by-digit accumulation, atoi() is
undefined; in practice on musl libc the modular wrap leaves
n == 0, which silently passes the "iterations > 0xffffU" check.
On Alpine Linux this made nsec3hash succeed with iterations
treated as 0 for inputs like 4294967296 (2^32).

The latent bug only surfaced when the recent image rebuild pulled
in Hypothesis 6.152.9 (2026-05-19), which unified the distribution
used for bounded and unbounded integers() strategies. The new
smoother distribution explores the 2^32 boundary on unbounded
ranges like integers(min_value=65536); earlier versions did not
reach there, so test_nsec3hash_too_many_iterations only started
failing on Alpine after the image refresh.

Replace the three atoi() calls with isc_parse_uint8 /
isc_parse_uint16, which uniformly reject overflow, trailing
garbage, leading sign, and non-numeric input across libc
implementations. As a side effect, error messages now include
the offending argument and a specific reason ("out of range" vs
"not a valid number").

Assisted-by: Claude:claude-opus-4-7
(cherry picked from commit e13302a6bc)
2026-05-21 11:54:03 +00:00
..
.gitignore Remove genrandom command and all usage of specific random files throughout the system test suite 2018-05-16 09:54:35 +02:00
arpaname.c Remove redundant parentheses from the return statement 2024-11-19 16:06:16 +01:00
arpaname.rst Use semantic markup for :program: self-references 2022-03-14 10:57:29 +01:00
dnstap-read.c Use EXIT_SUCCESS and EXIT_FAILURE 2024-08-06 15:19:06 +02:00
dnstap-read.rst Add internal hyperlinks to See Also section of manual pages 2022-03-14 11:01:32 +01:00
Makefile.am Fix the remaining cases of <prog>_CFLAGS -> <prog>_CPPFLAGS 2022-03-13 18:53:19 +01:00
mdig.c Use const pointer with strchr of const pointer 2026-01-20 06:00:56 +00:00
mdig.rst remove nonfunctional DSCP implementation 2023-01-09 14:23:26 -08:00
named-journalprint.c Remove redundant parentheses from the return statement 2024-11-19 16:06:16 +01:00
named-journalprint.rst Add internal hyperlinks to See Also section of manual pages 2022-03-14 11:01:32 +01:00
named-nzd2nzf.c Remove redundant parentheses from the return statement 2024-11-19 16:06:16 +01:00
named-nzd2nzf.rst Hyperlink program names to their manual pages 2022-03-14 11:01:31 +01:00
named-rrchecker.c Extend named-rrchecker multi-line parsing support 2025-06-03 02:27:51 +00:00
named-rrchecker.rst Fix link to TXT RRtype specification 2025-06-02 14:23:10 +00:00
nsec3hash.c Validate nsec3hash arguments instead of relying on atoi() 2026-05-21 11:54:03 +00:00
nsec3hash.rst Use semantic markup for :program: self-references 2022-03-14 10:57:29 +01:00