Skip to content

Commit

Permalink
Fix potential fault at createDoubleObject
Browse files Browse the repository at this point in the history
Resolves redis#963.

Add additional check to `hi_malloc` for `r->str` when len+1 equals to 0.
  • Loading branch information
afcidk committed Jun 14, 2021
1 parent b6f86f3 commit 5413631
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions hiredis.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,11 @@ static void *createDoubleObject(const redisReadTask *task, double value, char *s
freeReplyObject(r);
return NULL;
}
else if (len+1 == 0) {
hi_free(r->str);
freeReplyObject(r);
return NULL;
}

/* The double reply also has the original protocol string representing a
* double as a null terminated string. This way the caller does not need
Expand Down

0 comments on commit 5413631

Please sign in to comment.