summaryrefslogtreecommitdiff
path: root/deps/hiredis/alloc.h
diff options
context:
space:
mode:
Diffstat (limited to 'deps/hiredis/alloc.h')
-rw-r--r--deps/hiredis/alloc.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/deps/hiredis/alloc.h b/deps/hiredis/alloc.h
index 34a05f49f..771f9fee5 100644
--- a/deps/hiredis/alloc.h
+++ b/deps/hiredis/alloc.h
@@ -32,6 +32,7 @@
#define HIREDIS_ALLOC_H
#include <stddef.h> /* for size_t */
+#include <stdint.h>
#ifdef __cplusplus
extern "C" {
@@ -59,6 +60,10 @@ static inline void *hi_malloc(size_t size) {
}
static inline void *hi_calloc(size_t nmemb, size_t size) {
+ /* Overflow check as the user can specify any arbitrary allocator */
+ if (SIZE_MAX / size < nmemb)
+ return NULL;
+
return hiredisAllocFns.callocFn(nmemb, size);
}