summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>1997-03-18 07:54:24 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>1997-03-18 07:54:24 +0000
commit753da60320633bf92bb698ce3767a0d2e6d62a67 (patch)
treefa9d9605e6b5839374e9dd5ea6a0ca6dce3ec95e /lib
parent5f1376d7ec1f1e71d387883a0b385a3b1fae8e6a (diff)
Notes
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/stdlib/malloc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c
index 6462ad164690..f1eaffe76eda 100644
--- a/lib/libc/stdlib/malloc.c
+++ b/lib/libc/stdlib/malloc.c
@@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
- * $Id$
+ * $Id: malloc.c,v 1.21 1997/02/22 15:03:12 peter Exp $
*
*/
@@ -731,7 +731,9 @@ imalloc(size_t size)
if (suicide)
abort();
- if (size <= malloc_maxsize)
+ if ((size + malloc_pagesize) < size) /* Check for overflow */
+ result = 0;
+ else if (size <= malloc_maxsize)
result = malloc_bytes(size);
else
result = malloc_pages(size);