diff options
author | Jason Evans <jasone@FreeBSD.org> | 2008-04-29 01:32:42 +0000 |
---|---|---|
committer | Jason Evans <jasone@FreeBSD.org> | 2008-04-29 01:32:42 +0000 |
commit | e3085308bef8531efad096824db9743fab754af7 (patch) | |
tree | 10e714edd90a7fc17bab0fc8059378591b5371a9 /lib/libc/stdlib/malloc.c | |
parent | aec0c4d8226280fd6e1e67b63e937fcc7d1aa733 (diff) |
Notes
Diffstat (limited to 'lib/libc/stdlib/malloc.c')
-rw-r--r-- | lib/libc/stdlib/malloc.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c index 990cec9c5040..bc1ee0114775 100644 --- a/lib/libc/stdlib/malloc.c +++ b/lib/libc/stdlib/malloc.c @@ -1530,6 +1530,13 @@ static void * chunk_alloc_dss(size_t size) { + /* + * sbrk() uses a signed increment argument, so take care not to + * interpret a huge allocation request as a negative increment. + */ + if ((intptr_t)size < 0) + return (NULL); + malloc_mutex_lock(&dss_mtx); if (dss_prev != (void *)-1) { intptr_t incr; |