summaryrefslogtreecommitdiff
path: root/testapp.c
diff options
context:
space:
mode:
authorTrond Norbye <Trond.Norbye@sun.com>2009-10-28 11:51:05 +0100
committerDustin Sallings <dustin@spy.net>2009-10-28 18:09:00 -0700
commit75cc83685e103bc8ba380a57468c8f04413033f9 (patch)
treeb53c85f53b86b121611fbaadc15903aa6ddc299e /testapp.c
parent0731dc82d309cb721840a7ad9afd652ad079a9c6 (diff)
downloadmemcached-75cc83685e103bc8ba380a57468c8f04413033f9.tar.gz
Issue 102: Piping null to the server will crash it
Diffstat (limited to 'testapp.c')
-rw-r--r--testapp.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/testapp.c b/testapp.c
index b0491c3..5ff2a1f 100644
--- a/testapp.c
+++ b/testapp.c
@@ -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 },