Commit 739ba0d2 authored by Pieter Noordhuis's avatar Pieter Noordhuis
Browse files

add sanity check to zunionInterBlockClientOnSwappedKeys, as the number of keys...

add sanity check to zunionInterBlockClientOnSwappedKeys, as the number of keys used is provided as argument to the function
parent ca1788b5
...@@ -9562,13 +9562,15 @@ static void waitForMultipleSwappedKeys(redisClient *c, struct redisCommand *cmd, ...@@ -9562,13 +9562,15 @@ static void waitForMultipleSwappedKeys(redisClient *c, struct redisCommand *cmd,
} }
} }
/* Preload keys needed for the ZUNION and ZINTER commands. */ /* Preload keys needed for the ZUNION and ZINTER commands.
* Note that the number of keys to preload is user-defined, so we need to
* apply a sanity check against argc. */
static void zunionInterBlockClientOnSwappedKeys(redisClient *c, struct redisCommand *cmd, int argc, robj **argv) { static void zunionInterBlockClientOnSwappedKeys(redisClient *c, struct redisCommand *cmd, int argc, robj **argv) {
int i, num; int i, num;
REDIS_NOTUSED(cmd); REDIS_NOTUSED(cmd);
REDIS_NOTUSED(argc);
num = atoi(argv[2]->ptr); num = atoi(argv[2]->ptr);
if (num > (argc-3)) return;
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
waitForSwappedKey(c,argv[3+i]); waitForSwappedKey(c,argv[3+i]);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment