[MSAFD] Check params on WSAAceept. CORE-12104
authorPeter Hater <7element@mail.bg>
Fri, 4 Nov 2016 18:03:15 +0000 (18:03 +0000)
committerPeter Hater <7element@mail.bg>
Fri, 4 Nov 2016 18:03:15 +0000 (18:03 +0000)
svn path=/trunk/; revision=73123

reactos/dll/win32/msafd/misc/dllmain.c

index 1a2fef7..c7514da 100644 (file)
@@ -1351,6 +1351,13 @@ WSPAccept(SOCKET Handle,
        if (lpErrno) *lpErrno = WSAENOTSOCK;
        return SOCKET_ERROR;
     }
+    if ((SocketAddress && !SocketAddressLength) ||
+        (SocketAddressLength && !SocketAddress) ||
+        (SocketAddressLength && *SocketAddressLength < sizeof(SOCKADDR)))
+    {
+       if (lpErrno) *lpErrno = WSAEFAULT;
+       return INVALID_SOCKET;
+    }
 
     Status = NtCreateEvent(&SockEvent,
                            EVENT_ALL_ACCESS,