Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
7d9dd80d
Commit
7d9dd80d
authored
Apr 19, 2017
by
antirez
Browse files
Fix getKeysUsingCommandTable() in cluster mode.
Close #3940.
parent
189a12af
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/db.c
View file @
7d9dd80d
...
...
@@ -1133,11 +1133,24 @@ int *getKeysUsingCommandTable(struct redisCommand *cmd,robj **argv, int argc, in
*
numkeys
=
0
;
return
NULL
;
}
last
=
cmd
->
lastkey
;
if
(
last
<
0
)
last
=
argc
+
last
;
keys
=
zmalloc
(
sizeof
(
int
)
*
((
last
-
cmd
->
firstkey
)
+
1
));
for
(
j
=
cmd
->
firstkey
;
j
<=
last
;
j
+=
cmd
->
keystep
)
{
serverAssert
(
j
<
argc
);
if
(
j
>=
argc
)
{
/* Modules command do not have dispatch time arity checks, so
* we need to handle the case where the user passed an invalid
* number of arguments here. In this case we return no keys
* and expect the module command to report an arity error. */
if
(
cmd
->
flags
&
CMD_MODULE
)
{
zfree
(
keys
);
*
numkeys
=
0
;
return
NULL
;
}
else
{
serverPanic
(
"Redis built-in command declared keys positions not matching the arity requirements."
);
}
}
keys
[
i
++
]
=
j
;
}
*
numkeys
=
i
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment