server: Don't call close() on uninitialized memory in sock_check_pollhup

Sebastian Lackner sebastian at fds-team.de
Wed Jan 1 13:11:07 CST 2014


If socketpair() fails in the function sock_check_pollhup there is a jump
to the out-label - this calls close() on arbitrary uninitialized memory.
The attached patch should fix this.

---
 server/sock.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
-------------- next part --------------
>From 29eed6a3b0237b0b81afbb89e3c2d392324f0565 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian at fds-team.de>
Date: Tue, 31 Dec 2013 17:50:56 +0100
Subject: server: Don't call close() on uninitialized memory in
 sock_check_pollhup

---
 server/sock.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server/sock.c b/server/sock.c
index 1a3a8f7..5ffb1fe 100644
--- a/server/sock.c
+++ b/server/sock.c
@@ -194,7 +194,7 @@ static sock_shutdown_t sock_check_pollhup(void)
     struct pollfd pfd;
     char dummy;
 
-    if ( socketpair( AF_UNIX, SOCK_STREAM, 0, fd ) ) goto out;
+    if ( socketpair( AF_UNIX, SOCK_STREAM, 0, fd ) ) return ret;
     if ( shutdown( fd[0], 1 ) ) goto out;
 
     pfd.fd = fd[1];
-- 
1.7.9.5



More information about the wine-patches mailing list