bind9/bin/tools
Michal Nowak bb8321c637 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:41:29 +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 14:26:52 +01:00
arpaname.rst Use semantic markup for :program: self-references 2022-03-14 10:46:36 +01:00
dnstap-read.c Emit and read correct DoT and DoH dnstap entries 2024-04-26 16:12:29 +03:00
dnstap-read.rst Add option to dnstap-read to print long timestamps 2023-05-04 15:12:53 +02:00
Makefile.am Remove libbind9 2023-02-21 13:12:26 +00:00
mdig.c Rename isc_net_getudpportrange() to isc_net_getportrange() 2026-02-20 17:02:45 +01:00
mdig.rst fully remove DSCP 2023-01-17 16:18:21 -08:00
named-journalprint.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
named-journalprint.rst Add internal hyperlinks to See Also section of manual pages 2022-03-14 10:46:36 +01:00
named-nzd2nzf.c Remove redundant parentheses from the return statement 2024-11-19 14:26:52 +01:00
named-nzd2nzf.rst Hyperlink program names to their manual pages 2022-03-14 10:46:36 +01:00
named-rrchecker.c Extend named-rrchecker multi-line parsing support 2025-06-03 02:27:46 +00:00
named-rrchecker.rst Fix link to TXT RRtype specification 2025-06-02 14:23:05 +00:00
nsec3hash.c Validate nsec3hash arguments instead of relying on atoi() 2026-05-21 11:41:29 +00:00
nsec3hash.rst Use semantic markup for :program: self-references 2022-03-14 10:46:36 +01:00