Prevent dereferencing null fd

Bill Medland billmedland at mercuryspeed.com
Mon Apr 7 15:47:11 CDT 2003


Bill Medland (billmedland at mercuryspeed.com)
Prevent dereferencing null fd

Index: wine/server/named_pipe.c
===================================================================
RCS file: /home/wine/wine/server/named_pipe.c,v
retrieving revision 1.21
diff -u -r1.21 named_pipe.c
--- wine/server/named_pipe.c	12 Mar 2003 22:38:14 -0000	1.21
+++ wine/server/named_pipe.c	7 Apr 2003 20:44:31 -0000
@@ -163,7 +163,8 @@
 static struct fd *pipe_user_get_fd( struct object *obj )
 {
     struct pipe_user *user = (struct pipe_user *)obj;
-    return (struct fd *)grab_object( user->fd );
+    /* Beware.  If this is a client then the fd may be null */
+    return (user && user->fd) ? (struct fd *)grab_object( user->fd ) : 0;
 }
 
 static void pipe_user_destroy( struct object *obj)

-- 
Bill Medland
ACCPAC International, Inc.
medbi01 at accpac.com
Corporate: www.accpac.com
Hosted Services: www.accpaconline.com



More information about the wine-patches mailing list