aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/alloc.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 35b45c0..8682656 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -1,3 +1,4 @@
+#include <assert.h>
#include <errno.h>
#include <stdint.h>
#include <stdlib.h>
@@ -8,6 +9,7 @@
void *
bufalloc(void *ptr, size_t nmemb, size_t size)
{
+ assert(nmemb * size != 0);
if (size > SIZE_MAX / nmemb) {
errno = EOVERFLOW;
err("%s:", __func__);