[openssh-commits] [openssh] 01/02: Replace hand-rolled modulo with arc4random_uniform.
git+noreply at mindrot.org
git+noreply at mindrot.org
Fri Sep 26 08:50:12 AEST 2025
This is an automated email from the git hooks/post-receive script.
dtucker pushed a commit to branch master
in repository openssh.
commit 6c3c9f03c3c2cc4e40decbb49b8486abfb9e57df
Author: Darren Tucker <dtucker at dtucker.net>
AuthorDate: Fri Sep 26 08:23:21 2025 +1000
Replace hand-rolled modulo with arc4random_uniform.
Fixes potential modulo-by-zero UB flagged by Coverity CID 405068
---
regress/netcat.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/regress/netcat.c b/regress/netcat.c
index 0acedfd82..c62111780 100644
--- a/regress/netcat.c
+++ b/regress/netcat.c
@@ -1134,7 +1134,7 @@ build_ports(char *p)
char *c;
for (x = 0; x <= (hi - lo); x++) {
- y = (arc4random() & 0xFFFF) % (hi - lo);
+ y = arc4random_uniform(hi - lo);
c = portlist[x];
portlist[x] = portlist[y];
portlist[y] = c;
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list