Skip to content

Commit

Permalink
Merge pull request #964 from afcidk/fix-createDoubleObject
Browse files Browse the repository at this point in the history
Fix potential fault at createDoubleObject
  • Loading branch information
michael-grunder authored Aug 29, 2022
2 parents 9219f7e + 50cdcab commit 77e4f09
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions hiredis.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 77e4f09

Please sign in to comment.