diff dbmalloc.c @ 1365:9aa6cd66b51d fuzz

zlib can use m_malloc/m_free too
author Matt Johnston <matt@ucc.asn.au>
date Mon, 22 May 2017 22:09:26 +0800
parents f9f930e1a516
children 7209a6e30932
line wrap: on
line diff
--- a/dbmalloc.c	Sun May 21 18:53:44 2017 +0800
+++ b/dbmalloc.c	Mon May 22 22:09:26 2017 +0800
@@ -77,7 +77,9 @@
 }
 
 void * m_calloc(size_t nmemb, size_t size) {
-    assert(nmemb <= 1000 && size <= 10000);
+    if (SIZE_T_MAX / nmemb < size) {
+        dropbear_exit("m_calloc failed");
+    }
     return m_malloc(nmemb*size);
 }