From: yasuoka Date: Thu, 1 Aug 2024 00:58:14 +0000 (+0000) Subject: Use arc4random_uniform(n) instead of "% n". X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=7747427519647b5e156eb3da18162af89b3974a8;p=openbsd Use arc4random_uniform(n) instead of "% n". --- 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) {