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

Alexandre Julliard julliard at wine.codeweavers.com
Thu Jan 4 04:44:59 CST 2007


Module: wine
Branch: master
Commit: 31b02bbd1facee6a80d8e3eebc649ec974df17a6
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=31b02bbd1facee6a80d8e3eebc649ec974df17a6

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Jan  4 09:41:14 2007 +0100

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

---

 server/console.c |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/server/console.c b/server/console.c
index 5f44827..64601fb 100644
--- a/server/console.c
+++ b/server/console.c
@@ -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 );




More information about the wine-cvs mailing list