Replace hand-rolled modulo with arc4random_uniform.

Fixes potential modulo-by-zero UB flagged by Coverity CID 405068
This commit is contained in:
Darren Tucker committed 2025-09-26 08:23:21 +10:00
1 parent e914e61eb8
commit 6c3c9f03c3
1 file changed
+1 -1
+1 -1
View File
@@ -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;