diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2008-04-13 00:22:18 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2008-04-13 00:22:18 +0000 |
commit | f15cc9e98f102b443a7b1bc97ce7b524d3453c7e (patch) | |
tree | cd34ef18f375e585b2843c566e08b7a49da49084 /lib | |
parent | dd3e3e68352b843aef5b3347835e71e9f26a0d92 (diff) |
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 'lib')
-rw-r--r-- | lib/libc/stdlib/malloc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c index 8348b7ede18..c4869527adb 100644 --- a/lib/libc/stdlib/malloc.c +++ b/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++; |