From 3e091e5f9bb5ae7fbc3f63db4474a599ad3fe529 Mon Sep 17 00:00:00 2001 From: djm <> Date: Sun, 13 Apr 2008 00:22:17 +0000 Subject: Use arc4random_buf() when requesting more than a single word of output Use arc4random_uniform() when the desired random number upper bound is not a power of two ok deraadt@ millert@ --- src/regress/lib/libc/malloc/malloc0test/malloc0test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/regress/lib/libc/malloc/malloc0test') diff --git a/src/regress/lib/libc/malloc/malloc0test/malloc0test.c b/src/regress/lib/libc/malloc/malloc0test/malloc0test.c index eb00954f92..06ff0996ee 100644 --- a/src/regress/lib/libc/malloc/malloc0test/malloc0test.c +++ b/src/regress/lib/libc/malloc/malloc0test/malloc0test.c @@ -1,4 +1,4 @@ -/* $OpenBSD: malloc0test.c,v 1.4 2004/08/04 12:02:57 otto Exp $ */ +/* $OpenBSD: malloc0test.c,v 1.5 2008/04/13 00:22:17 djm Exp $ */ /* * Public domain. 2001, Theo de Raadt */ @@ -92,7 +92,7 @@ usage: limit = LONG_MAX; for (count = 0; count < limit; count++) { - size = arc4random() % SIZE; + size = arc4random_uniform(SIZE); blob = malloc(size); if (blob == NULL) { fprintf(stderr, "success: out of memory\n"); -- cgit v1.2.3-55-g6feb