scripting: no eval with negative key count

Negative key count causes segfault in Lua functions.

Fixes #1842
Closes #1843
This commit is contained in:
Matt Stancliff
2014-06-28 22:20:44 -04:00
committed by antirez
parent 50669f7b66
commit 4024220fe6
2 changed files with 8 additions and 0 deletions

View File

@ -909,6 +909,9 @@ void evalGenericCommand(redisClient *c, int evalsha) {
if (numkeys > (c->argc - 3)) {
addReplyError(c,"Number of keys can't be greater than number of args");
return;
} else if (numkeys < 0) {
addReplyError(c,"Number of keys can't be negative");
return;
}
/* We obtain the script SHA1, then check if this function is already