summaryrefslogtreecommitdiffstats
path: root/regress/lib/libc/malloc/malloc0test/malloc0test.c
diff options
context:
space:
mode:
authordjm <djm@openbsd.org>2008-04-13 00:22:16 +0000
committerdjm <djm@openbsd.org>2008-04-13 00:22:16 +0000
commit66ad965f4873a0970dea06fb53c307b8385e5a94 (patch)
tree4afc515a23e6b6330f9c5d210162905120f9188a /regress/lib/libc/malloc/malloc0test/malloc0test.c
parentbring in changes as found in libossaudio (diff)
downloadwireguard-openbsd-66ad965f4873a0970dea06fb53c307b8385e5a94.tar.xz
wireguard-openbsd-66ad965f4873a0970dea06fb53c307b8385e5a94.zip
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@
Diffstat (limited to 'regress/lib/libc/malloc/malloc0test/malloc0test.c')
-rw-r--r--regress/lib/libc/malloc/malloc0test/malloc0test.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/regress/lib/libc/malloc/malloc0test/malloc0test.c b/regress/lib/libc/malloc/malloc0test/malloc0test.c
index eb00954f928..06ff0996eef 100644
--- a/regress/lib/libc/malloc/malloc0test/malloc0test.c
+++ b/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");