summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2008-08-23 06:15:17 +0000
committerDamien Miller <djm@cvs.openbsd.org>2008-08-23 06:15:17 +0000
commitcd2160bb9c9ebf139a36363ec51a1fa90c263e3d (patch)
tree2fd151a6af5b92f7ef8a9c1a11079ca8c0111c02 /lib/libc
parent8ab2493c50b646a098b609180ee5ee1442203b12 (diff)
fix calloc() for MALLOC_OPTIONS=J case: SOME_JUNK was being filled into
the freshly mmaped pages disrupting their pure zeroness; ok otto@ deraadt@
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/stdlib/malloc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c
index 4379e091574..711c8470efa 100644
--- a/lib/libc/stdlib/malloc.c
+++ b/lib/libc/stdlib/malloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: malloc.c,v 1.95 2008/08/22 21:25:10 otto Exp $ */
+/* $OpenBSD: malloc.c,v 1.96 2008/08/23 06:15:16 djm Exp $ */
/*
* Copyright (c) 2008 Otto Moerbeek <otto@drijf.net>
*
@@ -1085,7 +1085,7 @@ omalloc(size_t sz, int zero_fill)
malloc_guarded += malloc_guard;
}
if (malloc_junk)
- memset(p, SOME_JUNK, psz - malloc_guard);
+ memset(p + sz, SOME_JUNK, psz - sz - malloc_guard);
/* shift towards the end */
if (malloc_move &&