Skip to content
Browse files

DEBUG CMDKEYS: provide some guarantee to getKeysFromCommand().

getKeysFromCommand() is designed to be called with the command arguments
passing the basic arity checks described in the command table.

DEBUG CMDKEYS must provide the same guarantees for calling
getKeysFromCommand() to be safe.
  • Loading branch information...
1 parent 5b86461 commit 2705306ba1304e6db46d4ebc3006b1dea40588b7 @antirez committed
Showing with 6 additions and 0 deletions.
  1. +6 −0 src/debug.c
View
6 src/debug.c
@@ -370,7 +370,13 @@ void debugCommand(redisClient *c) {
if (!cmd) {
addReplyError(c,"Invalid command specified");
return;
+ } else if ((cmd->arity > 0 && cmd->arity != c->argc-2) ||
+ ((c->argc-2) < -cmd->arity))
+ {
+ addReplyError(c,"Invalid number of arguments specified for command");
+ return;
}
+
keys = getKeysFromCommand(cmd,c->argv+2,c->argc-2,&numkeys);
addReplyMultiBulkLen(c,numkeys);
for (j = 0; j < numkeys; j++) addReplyBulk(c,c->argv[keys[j]+2]);

0 comments on commit 2705306

Please sign in to comment.
Something went wrong with that request. Please try again.