Commit ace9d329 authored by Sebastian Lackner's avatar Sebastian Lackner Committed by Alexandre Julliard

server: Fix crash when calling SetNamedPipeHandleState on partially closed pipe.

parent ee02530b
......@@ -1427,6 +1427,9 @@ static void test_CloseHandle(void)
ret = GetNamedPipeHandleStateA(hfile, &state, NULL, NULL, NULL, NULL, 0);
ok(ret, "GetNamedPipeHandleState failed with %u\n", GetLastError());
state = PIPE_READMODE_MESSAGE | PIPE_WAIT;
ret = SetNamedPipeHandleState(hfile, &state, NULL, NULL);
ok(ret, "SetNamedPipeHandleState failed with %u\n", GetLastError());
SetLastError(0xdeadbeef);
ret = ReadFile(hfile, buffer, 0, &numbytes, NULL);
......@@ -1464,6 +1467,9 @@ static void test_CloseHandle(void)
ret = GetNamedPipeHandleStateA(hfile, &state, NULL, NULL, NULL, NULL, 0);
ok(ret, "GetNamedPipeHandleState failed with %u\n", GetLastError());
state = PIPE_READMODE_MESSAGE | PIPE_WAIT;
ret = SetNamedPipeHandleState(hfile, &state, NULL, NULL);
ok(ret, "SetNamedPipeHandleState failed with %u\n", GetLastError());
SetLastError(0xdeadbeef);
ret = ReadFile(hfile, buffer, 0, &numbytes, NULL);
......@@ -1515,6 +1521,9 @@ static void test_CloseHandle(void)
ret = GetNamedPipeHandleStateA(hpipe, &state, NULL, NULL, NULL, NULL, 0);
ok(ret, "GetNamedPipeHandleState failed with %u\n", GetLastError());
state = PIPE_READMODE_MESSAGE | PIPE_WAIT;
ret = SetNamedPipeHandleState(hpipe, &state, NULL, NULL);
ok(ret, "SetNamedPipeHandleState failed with %u\n", GetLastError());
SetLastError(0xdeadbeef);
ret = ReadFile(hpipe, buffer, 0, &numbytes, NULL);
......@@ -1552,6 +1561,9 @@ static void test_CloseHandle(void)
ret = GetNamedPipeHandleStateA(hpipe, &state, NULL, NULL, NULL, NULL, 0);
ok(ret, "GetNamedPipeHandleState failed with %u\n", GetLastError());
state = PIPE_READMODE_MESSAGE | PIPE_WAIT;
ret = SetNamedPipeHandleState(hpipe, &state, NULL, NULL);
ok(ret, "SetNamedPipeHandleState failed with %u\n", GetLastError());
SetLastError(0xdeadbeef);
ret = ReadFile(hpipe, buffer, 0, &numbytes, NULL);
......
......@@ -1046,7 +1046,11 @@ DECL_HANDLER(set_named_pipe_info)
client = (struct pipe_client *)get_handle_obj( current->process, req->handle,
0, &pipe_client_ops );
if (!client) return;
server = client->server;
if (!(server = client->server))
{
release_object( client );
return;
}
}
if ((req->flags & ~(NAMED_PIPE_MESSAGE_STREAM_READ | NAMED_PIPE_NONBLOCKING_MODE)) ||
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment