diff options
author | Pei-Hsuan Hung <afcidk@gmail.com> | 2021-06-14 10:32:44 +0800 |
---|---|---|
committer | Pei-Hsuan Hung <afcidk@gmail.com> | 2021-11-01 12:17:05 +0800 |
commit | 50cdcab49d539e4703018185992abf3214088e85 (patch) | |
tree | 18c6891f86a28ff631ef9a7ac26a351217720f15 /hiredis.c | |
parent | c98c6994ded45e774c3459baa2936f06f8a2c331 (diff) |
Fix potential fault at createDoubleObject
Resolves #963.
Add additional check to `hi_malloc` for `r->str` when len equals to
SIZE_MAX.
Diffstat (limited to 'hiredis.c')
-rw-r--r-- | hiredis.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -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; |