Merge pull request #3657 from itamarhaber/patch-9

Verify pairs are provided after ZADD's subcommands
This commit is contained in:
Salvatore Sanfilippo 2017-01-25 09:31:47 +01:00 committed by GitHub
commit 41d16f7a4a

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;
} }