Commit 2017d8ba authored by Konstantin Merenkov's avatar Konstantin Merenkov Committed by antirez
Browse files

[issue 620] don't segfault if number of arguments is less than 1

parent a511ce1b
...@@ -327,6 +327,8 @@ int loadAppendOnlyFile(char *filename) { ...@@ -327,6 +327,8 @@ int loadAppendOnlyFile(char *filename) {
} }
if (buf[0] != '*') goto fmterr; if (buf[0] != '*') goto fmterr;
argc = atoi(buf+1); argc = atoi(buf+1);
if (argc < 1) goto fmterr;
argv = zmalloc(sizeof(robj*)*argc); argv = zmalloc(sizeof(robj*)*argc);
for (j = 0; j < argc; j++) { for (j = 0; j < argc; j++) {
if (fgets(buf,sizeof(buf),fp) == NULL) goto readerr; if (fgets(buf,sizeof(buf),fp) == NULL) goto readerr;
......
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