]> git.ipfire.org Git - thirdparty/bind9.git/commit
Fix assertion failure from arc4random_uniform with invalid limit
authorOndřej Surý <ondrej@isc.org>
Fri, 24 Oct 2025 08:34:33 +0000 (11:34 +0300)
committerOndřej Surý <ondrej@isc.org>
Fri, 24 Oct 2025 20:20:43 +0000 (22:20 +0200)
commit871bce312b651cebe2da9fcfc4688f3b49f6895c
treea965060b33610b6e49e9bd01b60f46fdfdbd3c60
parent92dfbbff9eb21cc78d38e4e238f61f3929ffb76e
Fix assertion failure from arc4random_uniform with invalid limit

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.)
lib/isc/include/isc/random.h