server: Avoid crash in alloc_console when the process has no parent.

This commit is contained in:
Alexandre Julliard 2007-01-04 09:41:14 +01:00
parent f9cbc4c70d
commit 31b02bbd1f
1 changed files with 13 additions and 5 deletions

View File

@ -1252,12 +1252,20 @@ DECL_HANDLER(alloc_console)
struct process *renderer = current->process;
struct console_input *console;
process = (req->pid) ? get_process_from_id( req->pid ) :
(struct process *)grab_object( renderer->parent );
if (req->pid)
{
if (!(process = get_process_from_id( req->pid ))) return;
}
else
{
if (!(process = renderer->parent))
{
set_error( STATUS_ACCESS_DENIED );
return;
}
grab_object( process );
}
reply->handle_in = 0;
reply->event = 0;
if (!process) return;
if (process != renderer && process->console)
{
set_error( STATUS_ACCESS_DENIED );