summaryrefslogtreecommitdiff
path: root/src/cluster.c
diff options
context:
space:
mode:
authorsundb <sundbcn@gmail.com>2021-08-06 03:42:20 +0800
committerGitHub <noreply@github.com>2021-08-05 22:42:20 +0300
commit8ea777a6a02cae22aeff95f054d810f30b7b69ad (patch)
treebdd956d7cd85c4e9064fe3fe9ff86c75f3d2c969 /src/cluster.c
parent39a4a44d7ddf7ca84f006d2332b6d049f05e5de4 (diff)
downloadredis-8ea777a6a02cae22aeff95f054d810f30b7b69ad.tar.gz
Sanitize dump payload: fix empty keys when RDB loading and restore command (#9297)
When we load rdb or restore command, if we encounter a length of 0, it will result in the creation of an empty key. This could either be a corrupt payload, or a result of a bug (see #8453 ) This PR mainly fixes the following: 1) When restore command will return `Bad data format` error. 2) When loading RDB, we will silently discard the key. Co-authored-by: Oran Agra <oran@redislabs.com>
Diffstat (limited to 'src/cluster.c')
-rw-r--r--src/cluster.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cluster.c b/src/cluster.c
index 8cd931975..9bc33f493 100644
--- a/src/cluster.c
+++ b/src/cluster.c
@@ -5227,7 +5227,7 @@ void restoreCommand(client *c) {
rioInitWithBuffer(&payload,c->argv[3]->ptr);
if (((type = rdbLoadObjectType(&payload)) == -1) ||
- ((obj = rdbLoadObject(type,&payload,key->ptr,c->db->id)) == NULL))
+ ((obj = rdbLoadObject(type,&payload,key->ptr,c->db->id,NULL)) == NULL))
{
addReplyError(c,"Bad data format");
return;