summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2020-11-23 15:42:12 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2020-11-23 15:42:12 +0000
commitf1197d24659c50a179cb662441330efa623b84cc (patch)
treed241c57b98e6bcf41405673894a6c50d00d66a56 /lib/libc
parentfcf23ae715af00a1d452ad792ef4c1c261765c79 (diff)
mapalign() only handles allocations >= a page; problem found by and ok semarie@
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/stdlib/malloc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c
index 86670fca876..7004a0aa368 100644
--- a/lib/libc/stdlib/malloc.c
+++ b/lib/libc/stdlib/malloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: malloc.c,v 1.266 2020/10/12 22:08:33 deraadt Exp $ */
+/* $OpenBSD: malloc.c,v 1.267 2020/11/23 15:42:11 otto Exp $ */
/*
* Copyright (c) 2008, 2010, 2011, 2016 Otto Moerbeek <otto@drijf.net>
* Copyright (c) 2012 Matthew Dempsky <matthew@openbsd.org>
@@ -1957,6 +1957,8 @@ omemalign(struct dir_info *pool, size_t alignment, size_t sz, int zero_fill,
return NULL;
}
+ if (sz < MALLOC_PAGESIZE)
+ sz = MALLOC_PAGESIZE;
sz += mopts.malloc_guard;
psz = PAGEROUND(sz);