summary refs log tree commit diff
path: root/malloc
diff options
context:
space:
mode:
Diffstat (limited to 'malloc')
-rw-r--r--malloc/malloc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/malloc/malloc.c b/malloc/malloc.c
index e096f00eeb..09085e81ad 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -1263,8 +1263,9 @@ static void      free_atfork();
 
 #define request2size(req, nb) \
  ((nb = (req) + (SIZE_SZ + MALLOC_ALIGN_MASK)),\
-  ((long)nb <= 0 ? 1 : ((nb < (MINSIZE + MALLOC_ALIGN_MASK) ? (nb = MINSIZE) :\
-                         (nb &= ~MALLOC_ALIGN_MASK)), 0)))
+  ((long)nb <= 0 || nb < (INTERNAL_SIZE_T) (req) \
+   ? 1 : ((nb < (MINSIZE + MALLOC_ALIGN_MASK) \
+	   ? (nb = MINSIZE) : (nb &= ~MALLOC_ALIGN_MASK)), 0)))
 
 /* Check if m has acceptable alignment */