Check arity in SLOWLOG before accessing arg

This commit is contained in:
Itamar Haber 2017-11-30 00:30:30 +02:00
parent 51d42c88a6
commit 0752a834f9

View File

@ -140,7 +140,7 @@ void slowlogReset(void) {
/* The SLOWLOG command. Implements all the subcommands needed to handle the /* The SLOWLOG command. Implements all the subcommands needed to handle the
* Redis slow log. */ * Redis slow log. */
void slowlogCommand(client *c) { void slowlogCommand(client *c) {
if (!strcasecmp(c->argv[1]->ptr,"help") && c->argc == 2) { if (c->argc == 2 && !strcasecmp(c->argv[1]->ptr,"help")) {
const char *help[] = { const char *help[] = {
"get [count] -- Return the top entries from the slowlog (default: 10).", "get [count] -- Return the top entries from the slowlog (default: 10).",
"len -- Return the length of the slowlog.", "len -- Return the length of the slowlog.",