Bruno Jesus : ws2_32: Don' t try to receive data in an OOB_INLINED socket with MSG_OOB.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Mar 30 10:12:57 CDT 2015


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

Author: Bruno Jesus <00cpxxx at gmail.com>
Date:   Sun Mar 29 00:53:11 2015 -0300

ws2_32: Don't try to receive data in an OOB_INLINED socket with MSG_OOB.

---

 dlls/ws2_32/socket.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index e7e3de5..1bcb63c 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -6713,7 +6713,7 @@ static int WS2_recv_base( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
 {
     unsigned int i, options;
     int n, fd, err, overlapped;
-    struct ws2_async *wsa, localwsa;
+    struct ws2_async *wsa = NULL, localwsa;
     BOOL is_blocking;
     DWORD timeout_start = GetTickCount();
     ULONG_PTR cvalue = (lpOverlapped && ((ULONG_PTR)lpOverlapped->hEvent & 1) == 0) ? (ULONG_PTR)lpOverlapped : 0;
@@ -6728,6 +6728,18 @@ static int WS2_recv_base( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
 
     if (fd == -1) return SOCKET_ERROR;
 
+    if (*lpFlags & WS_MSG_OOB)
+    {
+        /* It's invalid to receive OOB data from an OOBINLINED socket
+         * as OOB data is turned into normal data. */
+        i = sizeof(n);
+        if (!getsockopt(fd, SOL_SOCKET, SO_OOBINLINE, (char*) &n, &i) && n)
+        {
+            err = WSAEINVAL;
+            goto error;
+        }
+    }
+
     overlapped = (lpOverlapped || lpCompletionRoutine) &&
         !(options & (FILE_SYNCHRONOUS_IO_ALERT | FILE_SYNCHRONOUS_IO_NONALERT));
     if (overlapped || dwBufferCount > 1)




More information about the wine-cvs mailing list