[MSAFD] Don't try to accept on non listening socket. Return WSAEINVAL
[reactos.git] / reactos / dll / win32 / msafd / misc / dllmain.c
index 747299e..45a1d17 100644 (file)
@@ -1464,6 +1464,11 @@ WSPAccept(SOCKET Handle,
        if (lpErrno) *lpErrno = WSAENOTSOCK;
        return SOCKET_ERROR;
     }
+    if (!Socket->SharedData->Listening)
+    {
+       if (lpErrno) *lpErrno = WSAEINVAL;
+       return SOCKET_ERROR;
+    }
     if ((SocketAddress && !SocketAddressLength) ||
         (SocketAddressLength && !SocketAddress) ||
         (SocketAddressLength && *SocketAddressLength < sizeof(SOCKADDR)))