Commit af62d9a6 authored by Chris Lamb's avatar Chris Lamb Committed by antirez
Browse files

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: default avatarChris Lamb <lamby@debian.org>

Fixes #1191
parent 354119e4
...@@ -337,6 +337,7 @@ char* loadStringObject() { ...@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment