Permalink
Browse files

fix segfault when sending a zero byte command

echo "" | nc localhost 11211 would segfault the server

simple fix is to add the proper token check to the one place it's missing.
  • Loading branch information...
dormando committed Jan 26, 2012
1 parent c0387e3 commit 29bfd5a17fd35de1d044eba9c17fe84a0b3b58ff
Showing with 1 addition and 1 deletion.
  1. +1 −1 memcached.c
View
@@ -3329,7 +3329,7 @@ static void process_command(conn *c, char *command) {
conn_set_state(c, conn_closing);
- } else if (strcmp(tokens[COMMAND_TOKEN].value, "slabs") == 0) {
+ } else if (ntokens > 1 && strcmp(tokens[COMMAND_TOKEN].value, "slabs") == 0) {
if (ntokens == 5 && strcmp(tokens[COMMAND_TOKEN + 1].value, "reassign") == 0) {
int src, dst, rv;

0 comments on commit 29bfd5a

Please sign in to comment.