From 00f084b6ec75bc025c20411f4946bba69d14a33a Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Tue, 22 Apr 2014 14:34:57 +0300 Subject: [PATCH] utils: detect overflow in memdup() Signed-off-by: Ran Benita --- src/utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils.h b/src/utils.h index 878c2ac..0198f07 100644 --- a/src/utils.h +++ b/src/utils.h @@ -99,7 +99,7 @@ strempty(const char *s) static inline void * memdup(const void *mem, size_t nmemb, size_t size) { - void *p = malloc(nmemb * size); + void *p = calloc(nmemb, size); if (p) memcpy(p, mem, nmemb * size); return p;