diff --git a/src/cluster.c b/src/cluster.c index ce0bb8aa..20a05271 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -1645,6 +1645,10 @@ void clusterCommand(redisClient *c) { if (getLongLongFromObjectOrReply(c,c->argv[2],&slot,NULL) != REDIS_OK) return; + if (slot < 0 || slot >= REDIS_CLUSTER_SLOTS) { + addReplyError(c,"Invalid slot"); + return; + } addReplyLongLong(c,countKeysInSlot(slot)); } else if (!strcasecmp(c->argv[1]->ptr,"getkeysinslot") && c->argc == 4) { long long maxkeys, slot;