diff options
author | antirez <antirez@gmail.com> | 2014-03-10 16:43:38 +0100 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2014-03-11 11:10:33 +0100 |
commit | ab8e1bbcdcf3756255c956f3c50a8c5c822dd4c3 (patch) | |
tree | dac7bfc71460909e3c2d2a8ef82467b4da498870 | |
parent | 94129415bf1d02fc2798521192354015dbd9f652 (diff) | |
download | redis-ab8e1bbcdcf3756255c956f3c50a8c5c822dd4c3.tar.gz |
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.
-rw-r--r-- | src/debug.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/debug.c b/src/debug.c index e9863e2fc..198334b9d 100644 --- a/src/debug.c +++ b/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]); |