comparison 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
comparison
equal deleted inserted replaced
1364:17104db7928c 1365:9aa6cd66b51d
75 header->epoch = current_epoch; 75 header->epoch = current_epoch;
76 return &mem[sizeof(struct dbmalloc_header)]; 76 return &mem[sizeof(struct dbmalloc_header)];
77 } 77 }
78 78
79 void * m_calloc(size_t nmemb, size_t size) { 79 void * m_calloc(size_t nmemb, size_t size) {
80 assert(nmemb <= 1000 && size <= 10000); 80 if (SIZE_T_MAX / nmemb < size) {
81 dropbear_exit("m_calloc failed");
82 }
81 return m_malloc(nmemb*size); 83 return m_malloc(nmemb*size);
82 } 84 }
83 85
84 void * m_realloc(void* ptr, size_t size) { 86 void * m_realloc(void* ptr, size_t size) {
85 char* mem = NULL; 87 char* mem = NULL;