summaryrefslogtreecommitdiff
path: root/src/utils.h
diff options
context:
space:
mode:
authorRan Benita <ran234@gmail.com>2014-04-22 14:34:57 +0300
committerRan Benita <ran234@gmail.com>2014-04-22 14:56:01 +0300
commit00f084b6ec75bc025c20411f4946bba69d14a33a (patch)
tree8a65b80620a15bfbd20f72b94cfb205258cb9f88 /src/utils.h
parent95aabeecb1d1947456a1ab0d0e61399a97bcd747 (diff)
downloadlibxkbcommon-00f084b6ec75bc025c20411f4946bba69d14a33a.tar.gz
libxkbcommon-00f084b6ec75bc025c20411f4946bba69d14a33a.tar.bz2
libxkbcommon-00f084b6ec75bc025c20411f4946bba69d14a33a.zip
utils: detect overflow in memdup()
Signed-off-by: Ran Benita <ran234@gmail.com>
Diffstat (limited to 'src/utils.h')
-rw-r--r--src/utils.h2
1 files changed, 1 insertions, 1 deletions
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;