summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Grunder <michael.grunder@gmail.com>2022-08-29 12:24:57 -0700
committerGitHub <noreply@github.com>2022-08-29 12:24:57 -0700
commit77e4f09ea8e01a500586c6b2aa37a76c98e172f0 (patch)
tree9e1c3e57795ab2e62c54c9f8d2a25132bd3d661b
parent9219f7e7c3e7fa4085658888398e42d6da70584c (diff)
parent50cdcab49d539e4703018185992abf3214088e85 (diff)
Merge pull request #964 from afcidk/fix-createDoubleObject
Fix potential fault at createDoubleObject
-rw-r--r--hiredis.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/hiredis.c b/hiredis.c
index 91086f6..1fd8570 100644
--- a/hiredis.c
+++ b/hiredis.c
@@ -221,6 +221,9 @@ static void *createIntegerObject(const redisReadTask *task, long long value) {
static void *createDoubleObject(const redisReadTask *task, double value, char *str, size_t len) {
redisReply *r, *parent;
+ if (len == SIZE_MAX) // Prevents hi_malloc(0) if len equals to SIZE_MAX
+ return NULL;
+
r = createReplyObject(REDIS_REPLY_DOUBLE);
if (r == NULL)
return NULL;