summaryrefslogtreecommitdiff
path: root/libexec/ld.so/malloc.c
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2014-11-03 06:08:57 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2014-11-03 06:08:57 +0000
commitfd2467dffa33eac43f053e7a05843ea18491f2a9 (patch)
tree8abbf79826f4bc1d806f8af28a8b93188b5eda58 /libexec/ld.so/malloc.c
parent6c34ed722d14159b96eee2b41687b7d9847fef6a (diff)
arc4random_uniform() transformation was off, resulting in badly skewed
distribution in the placement of malloc's dir_info. ok otto@ deraadt@
Diffstat (limited to 'libexec/ld.so/malloc.c')
-rw-r--r--libexec/ld.so/malloc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libexec/ld.so/malloc.c b/libexec/ld.so/malloc.c
index ae2bec97de7..df23ccc0e56 100644
--- a/libexec/ld.so/malloc.c
+++ b/libexec/ld.so/malloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: malloc.c,v 1.4 2014/07/06 08:34:12 otto Exp $ */
+/* $OpenBSD: malloc.c,v 1.5 2014/11/03 06:08:56 guenther Exp $ */
/*
* Copyright (c) 2008, 2010, 2011 Otto Moerbeek <otto@drijf.net>
* Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org>
@@ -379,7 +379,7 @@ omalloc_init(struct dir_info **dp)
_dl_randombuf(&tmp, sizeof(tmp));
d = (struct dir_info *)(p + MALLOC_PAGESIZE +
- ((d_avail % tmp) << MALLOC_MINSHIFT)); /* not uniform */
+ ((tmp % d_avail) << MALLOC_MINSHIFT)); /* not uniform */
rbytes_init(d);
d->regions_free = d->regions_total = MALLOC_INITIAL_REGIONS;