From 7747427519647b5e156eb3da18162af89b3974a8 Mon Sep 17 00:00:00 2001 From: yasuoka Date: Thu, 1 Aug 2024 00:58:14 +0000 Subject: [PATCH] Use arc4random_uniform(n) instead of "% n". --- usr.sbin/radiusd/radiusd_ipcp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.sbin/radiusd/radiusd_ipcp.c b/usr.sbin/radiusd/radiusd_ipcp.c index c4b6ca7fea3..407af6d6c86 100644 --- a/usr.sbin/radiusd/radiusd_ipcp.c +++ b/usr.sbin/radiusd/radiusd_ipcp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radiusd_ipcp.c,v 1.7 2024/07/22 10:00:16 yasuoka Exp $ */ +/* $OpenBSD: radiusd_ipcp.c,v 1.8 2024/08/01 00:58:14 yasuoka Exp $ */ /* * Copyright (c) 2024 Internet Initiative Japan Inc. @@ -794,7 +794,7 @@ ipcp_resdeco(void *ctx, u_int q_id, const u_char *req, size_t reqlen, if (!found) goto reject; } else { - n = arc4random() % self->npools; + n = arc4random_uniform(self->npools); i = 0; TAILQ_FOREACH(addr, &self->addrs, next) { if (addr->type == ADDRESS_TYPE_POOL) { -- 2.20.1