diff options
author | Trond Norbye <Trond.Norbye@sun.com> | 2009-10-28 11:51:05 +0100 |
---|---|---|
committer | Dustin Sallings <dustin@spy.net> | 2009-10-28 18:09:00 -0700 |
commit | 75cc83685e103bc8ba380a57468c8f04413033f9 (patch) | |
tree | b53c85f53b86b121611fbaadc15903aa6ddc299e /testapp.c | |
parent | 0731dc82d309cb721840a7ad9afd652ad079a9c6 (diff) | |
download | memcached-75cc83685e103bc8ba380a57468c8f04413033f9.tar.gz |
Issue 102: Piping null to the server will crash it
Diffstat (limited to 'testapp.c')
-rw-r--r-- | testapp.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -538,6 +538,22 @@ static enum test_return test_issue_92(void) { return TEST_PASS; } +static enum test_return test_issue_102(void) { + char buffer[4096]; + memset(buffer, ' ', sizeof(buffer)); + buffer[sizeof(buffer) - 1] = '\0'; + + close(sock); + sock = connect_server("127.0.0.1", port, false); + + send_ascii_command(buffer); + /* verify that the server closed the connection */ + assert(read(sock, buffer, sizeof(buffer)) == 0); + close(sock); + sock = connect_server("127.0.0.1", port, false); + return TEST_PASS; +} + static enum test_return start_memcached_server(void) { server_pid = start_server(&port, false, 600); sock = connect_server("127.0.0.1", port, false); @@ -1676,6 +1692,7 @@ struct testcase testcases[] = { /* The following tests all run towards the same server */ { "start_server", start_memcached_server }, { "issue_92", test_issue_92 }, + { "issue_102", test_issue_102 }, { "binary_noop", test_binary_noop }, { "binary_quit", test_binary_quit }, { "binary_quitq", test_binary_quitq }, |