From: Konstantin Merenkov Date: Tue, 2 Aug 2011 13:05:04 +0000 (+0400) Subject: [issue 620] don't segfault if number of arguments is less than 1 X-Git-Url: https://git.saurik.com/redis.git/commitdiff_plain/be6f639564a472a54371ecf846a132218c7039ae [issue 620] don't segfault if number of arguments is less than 1 --- diff --git a/src/aof.c b/src/aof.c index b43f99f5..517b55fb 100644 --- a/src/aof.c +++ b/src/aof.c @@ -263,6 +263,8 @@ int loadAppendOnlyFile(char *filename) { } if (buf[0] != '*') goto fmterr; argc = atoi(buf+1); + if (argc < 1) goto fmterr; + argv = zmalloc(sizeof(robj*)*argc); for (j = 0; j < argc; j++) { if (fgets(buf,sizeof(buf),fp) == NULL) goto readerr;