diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libc/stdlib/malloc.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lib/libc/stdlib/malloc.c b/src/lib/libc/stdlib/malloc.c index ba8bd3ad8f..5d5437dc1f 100644 --- a/src/lib/libc/stdlib/malloc.c +++ b/src/lib/libc/stdlib/malloc.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: malloc.c,v 1.167 2014/06/02 08:49:38 otto Exp $ */ | 1 | /* $OpenBSD: malloc.c,v 1.168 2014/06/27 17:37:42 otto Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2008, 2010, 2011 Otto Moerbeek <otto@drijf.net> | 3 | * Copyright (c) 2008, 2010, 2011 Otto Moerbeek <otto@drijf.net> |
| 4 | * Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org> | 4 | * Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org> |
| @@ -118,7 +118,7 @@ struct dir_info { | |||
| 118 | /* delayed free chunk slots */ | 118 | /* delayed free chunk slots */ |
| 119 | void *delayed_chunks[MALLOC_DELAYED_CHUNK_MASK + 1]; | 119 | void *delayed_chunks[MALLOC_DELAYED_CHUNK_MASK + 1]; |
| 120 | size_t rbytesused; /* random bytes used */ | 120 | size_t rbytesused; /* random bytes used */ |
| 121 | u_char rbytes[512]; /* random bytes */ | 121 | u_char rbytes[32]; /* random bytes */ |
| 122 | u_short chunk_start; | 122 | u_short chunk_start; |
| 123 | #ifdef MALLOC_STATS | 123 | #ifdef MALLOC_STATS |
| 124 | size_t inserts; | 124 | size_t inserts; |
| @@ -276,7 +276,8 @@ static void | |||
| 276 | rbytes_init(struct dir_info *d) | 276 | rbytes_init(struct dir_info *d) |
| 277 | { | 277 | { |
| 278 | arc4random_buf(d->rbytes, sizeof(d->rbytes)); | 278 | arc4random_buf(d->rbytes, sizeof(d->rbytes)); |
| 279 | d->rbytesused = 0; | 279 | /* add 1 to account for using d->rbytes[0] */ |
| 280 | d->rbytesused = 1 + d->rbytes[0] % (sizeof(d->rbytes) / 2); | ||
| 280 | } | 281 | } |
| 281 | 282 | ||
| 282 | static inline u_char | 283 | static inline u_char |
