Skip to content

Commit d35334f

Browse files
committed
fix segfault in "lru" command
fixes #474 - off by one in token count.
1 parent 4627095 commit d35334f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: memcached.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -4632,7 +4632,7 @@ static void process_lru_command(conn *c, token_t *tokens, const size_t ntokens)
46324632
out_string(c, "OK");
46334633
}
46344634
}
4635-
} else if (strcmp(tokens[1].value, "mode") == 0 && ntokens >= 3 &&
4635+
} else if (strcmp(tokens[1].value, "mode") == 0 && ntokens >= 4 &&
46364636
settings.lru_maintainer_thread) {
46374637
if (strcmp(tokens[2].value, "flat") == 0) {
46384638
settings.lru_segmented = false;
@@ -4643,7 +4643,7 @@ static void process_lru_command(conn *c, token_t *tokens, const size_t ntokens)
46434643
} else {
46444644
out_string(c, "ERROR");
46454645
}
4646-
} else if (strcmp(tokens[1].value, "temp_ttl") == 0 && ntokens >= 3 &&
4646+
} else if (strcmp(tokens[1].value, "temp_ttl") == 0 && ntokens >= 4 &&
46474647
settings.lru_maintainer_thread) {
46484648
if (!safe_strtol(tokens[2].value, &ttl)) {
46494649
out_string(c, "ERROR");

0 commit comments

Comments
 (0)