bad data on RESTORE can no longer crash the server but create a memory leak with some input string

This commit is contained in:
antirez 2011-04-05 13:57:28 +02:00
parent f304f22b22
commit f797c7dc17

View File

@ -1140,8 +1140,10 @@ void restoreCommand(redisClient *c) {
/* Finally create the object from the serialized dump and
* store it at the specified key. */
o = rdbLoadObject(data[0],fp);
if (o == NULL) {
if ((data[0] > 4 && data[0] < 9) ||
data[0] > 11 ||
(o = rdbLoadObject(data[0],fp)) == NULL)
{
addReplyError(c,"Bad data format.");
fclose(fp);
return;