From 29bfd5a17fd35de1d044eba9c17fe84a0b3b58ff Mon Sep 17 00:00:00 2001 From: dormando Date: Thu, 26 Jan 2012 12:36:07 -0800 Subject: 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. --- memcached.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/memcached.c b/memcached.c index 33d3e80..8d4c3d7 100644 --- a/memcached.c +++ b/memcached.c @@ -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; -- cgit v1.2.1