]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[9.20] chg: dev: Fix assertion failure from arc4random_uniform with invalid limit
authorOndřej Surý <ondrej@isc.org>
Fri, 24 Oct 2025 21:04:25 +0000 (23:04 +0200)
committerOndřej Surý <ondrej@isc.org>
Fri, 24 Oct 2025 21:04:25 +0000 (23:04 +0200)
When the arc4random_uniform() is called on NetBSD with upper_bound that
makes no sense statistically (0 or 1), the call crashes the calling
program.  Fix this by returning 0 when upper bound is < 2 as does Linux,
FreeBSD and NetBSD.  (Hint: System CSPRNG should never crash.)

Closes #5596

Backport of MR !11147

Merge branch 'backport-5596-fix-isc_random_uniform-on-NetBSD-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!11151


Trivial merge