Verify pairs are provided after subcommands

Fixes https://github.com/antirez/redis/issues/3639
This commit is contained in:
Itamar Haber 2016-12-02 18:19:36 +02:00 committed by GitHub
parent 6eb0c52d4c
commit 5dc4fe1529

View File

@ -1521,7 +1521,7 @@ void zaddGenericCommand(client *c, int flags) {
/* After the options, we expect to have an even number of args, since /* After the options, we expect to have an even number of args, since
* we expect any number of score-element pairs. */ * we expect any number of score-element pairs. */
elements = c->argc-scoreidx; elements = c->argc-scoreidx;
if (elements % 2) { if (elements % 2 || !elements) {
addReply(c,shared.syntaxerr); addReply(c,shared.syntaxerr);
return; return;
} }