]> git.saurik.com Git - redis.git/commitdiff
bad data on RESTORE can no longer crash the server but create a memory leak with...
authorantirez <antirez@gmail.com>
Tue, 5 Apr 2011 11:57:28 +0000 (13:57 +0200)
committerantirez <antirez@gmail.com>
Tue, 5 Apr 2011 11:57:28 +0000 (13:57 +0200)
src/cluster.c

index b57dd48ca8588817d0769a674966cc53a63b7345..783c658d43681d2d731e631c6f3bc7e6fa1b151a 100644 (file)
@@ -1140,8 +1140,10 @@ void restoreCommand(redisClient *c) {
 
     /* Finally create the object from the serialized dump and
      * store it at the specified key. */
 
     /* 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;
         addReplyError(c,"Bad data format.");
         fclose(fp);
         return;