diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c index 8348b7ed..c4869527 100644 --- a/src/lib/libc/stdlib/malloc.c +++ b/src/lib/libc/stdlib/malloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: malloc.c,v 1.88 2008/02/20 18:31:34 otto Exp $ */ +/* $OpenBSD: malloc.c,v 1.89 2008/04/13 00:22:16 djm Exp $ */ /* * ---------------------------------------------------------------------------- @@ -1140,7 +1140,7 @@ malloc_bytes(size_t size) if (malloc_guard) { /* Walk to a random position. */ - i = arc4random() % bp->free; + i = arc4random_uniform(bp->free); while (i > 0) { u += u; k++; diff --git a/src/usr.sbin/ntpd/ntp.c b/src/usr.sbin/ntpd/ntp.c index 28234875..7026a9ba 100644 --- a/src/usr.sbin/ntpd/ntp.c +++ b/src/usr.sbin/ntpd/ntp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntp.c,v 1.103 2008/01/28 11:45:59 mpf Exp $ */ +/* $OpenBSD: ntp.c,v 1.104 2008/04/13 00:22:17 djm Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -659,7 +659,7 @@ scale_interval(time_t requested) time_t interval, r; interval = requested * conf->scale; - r = arc4random() % MAX(5, interval / 10); + r = arc4random_uniform(MAX(5, interval / 10)); return (interval + r); } @@ -669,7 +669,7 @@ error_interval(void) time_t interval, r; interval = INTERVAL_QUERY_PATHETIC * QSCALE_OFF_MAX / QSCALE_OFF_MIN; - r = arc4random() % (interval / 10); + r = arc4random_uniform(interval / 10); return (interval + r); }