mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 08:38:27 -05:00
redis-check-dump: Prevent segfault if can't malloc
Found by The Mayhem Team (Alexandre Rebert, Thanassis Avgerinos, Sang Kil Cha, David Brumley, Manuel Egele) Cylab, Carnegie Mellon University. See http://bugs.debian.org/716259 for more. Signed-off-by: Chris Lamb <lamby@debian.org> Fixes #1191
This commit is contained in:
parent
354119e4c5
commit
af62d9a687
@ -337,6 +337,7 @@ char* loadStringObject() {
|
|||||||
if (len == REDIS_RDB_LENERR) return NULL;
|
if (len == REDIS_RDB_LENERR) return NULL;
|
||||||
|
|
||||||
char *buf = malloc(sizeof(char) * (len+1));
|
char *buf = malloc(sizeof(char) * (len+1));
|
||||||
|
if (buf == NULL) return NULL;
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
if (!readBytes(buf, len)) {
|
if (!readBytes(buf, len)) {
|
||||||
free(buf);
|
free(buf);
|
||||||
|
Loading…
Reference in New Issue
Block a user