summaryrefslogtreecommitdiff
path: root/monitor_mm.c
diff options
context:
space:
mode:
Diffstat (limited to 'monitor_mm.c')
-rw-r--r--monitor_mm.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/monitor_mm.c b/monitor_mm.c
index fbf57b439..b4a6e40c9 100644
--- a/monitor_mm.c
+++ b/monitor_mm.c
@@ -24,7 +24,7 @@
24 */ 24 */
25 25
26#include "includes.h" 26#include "includes.h"
27RCSID("$OpenBSD: monitor_mm.c,v 1.7 2002/06/28 01:49:31 millert Exp $"); 27RCSID("$OpenBSD: monitor_mm.c,v 1.8 2002/08/02 14:43:15 millert Exp $");
28 28
29#ifdef HAVE_SYS_MMAN_H 29#ifdef HAVE_SYS_MMAN_H
30#include <sys/mman.h> 30#include <sys/mman.h>
@@ -167,8 +167,10 @@ mm_malloc(struct mm_master *mm, size_t size)
167 167
168 if (size == 0) 168 if (size == 0)
169 fatal("mm_malloc: try to allocate 0 space"); 169 fatal("mm_malloc: try to allocate 0 space");
170 if (size > SIZE_T_MAX - MM_MINSIZE + 1)
171 fatal("mm_malloc: size too big");
170 172
171 size = ((size + MM_MINSIZE - 1) / MM_MINSIZE) * MM_MINSIZE; 173 size = ((size + (MM_MINSIZE - 1)) / MM_MINSIZE) * MM_MINSIZE;
172 174
173 RB_FOREACH(mms, mmtree, &mm->rb_free) { 175 RB_FOREACH(mms, mmtree, &mm->rb_free) {
174 if (mms->size >= size) 176 if (mms->size >= size)