Author: phater
Date: Mon Oct 17 15:24:43 2016
New Revision: 72978
URL:
http://svn.reactos.org/svn/reactos?rev=72978&view=rev
Log:
[MSAFD] Add some parameter checks on send/recv based on wine tests. CORE-12104
Modified:
trunk/reactos/dll/win32/msafd/misc/sndrcv.c
Modified: trunk/reactos/dll/win32/msafd/misc/sndrcv.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msafd/misc/sndrc…
==============================================================================
--- trunk/reactos/dll/win32/msafd/misc/sndrcv.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/msafd/misc/sndrcv.c [iso-8859-1] Mon Oct 17 15:24:43 2016
@@ -208,8 +208,15 @@
Socket = GetSocketStructure(Handle);
if (!Socket)
{
- *lpErrno = WSAENOTSOCK;
- return SOCKET_ERROR;
+ if (lpErrno)
+ *lpErrno = WSAENOTSOCK;
+ return SOCKET_ERROR;
+ }
+ if (!lpNumberOfBytesRead && !lpOverlapped)
+ {
+ if (lpErrno)
+ *lpErrno = WSAEFAULT;
+ return SOCKET_ERROR;
}
Status = NtCreateEvent( &SockEvent, EVENT_ALL_ACCESS,
@@ -389,8 +396,15 @@
Socket = GetSocketStructure(Handle);
if (!Socket)
{
- *lpErrno = WSAENOTSOCK;
- return SOCKET_ERROR;
+ if (lpErrno)
+ *lpErrno = WSAENOTSOCK;
+ return SOCKET_ERROR;
+ }
+ if (!lpNumberOfBytesRead && !lpOverlapped)
+ {
+ if (lpErrno)
+ *lpErrno = WSAEFAULT;
+ return SOCKET_ERROR;
}
if (!(Socket->SharedData->ServiceFlags1 & XP1_CONNECTIONLESS))
@@ -591,8 +605,15 @@
Socket = GetSocketStructure(Handle);
if (!Socket)
{
- *lpErrno = WSAENOTSOCK;
- return SOCKET_ERROR;
+ if (lpErrno)
+ *lpErrno = WSAENOTSOCK;
+ return SOCKET_ERROR;
+ }
+ if (!lpNumberOfBytesSent && !lpOverlapped)
+ {
+ if (lpErrno)
+ *lpErrno = WSAEFAULT;
+ return SOCKET_ERROR;
}
Status = NtCreateEvent( &SockEvent, EVENT_ALL_ACCESS,
@@ -740,8 +761,15 @@
Socket = GetSocketStructure(Handle);
if (!Socket)
{
- *lpErrno = WSAENOTSOCK;
- return SOCKET_ERROR;
+ if (lpErrno)
+ *lpErrno = WSAENOTSOCK;
+ return SOCKET_ERROR;
+ }
+ if (!lpNumberOfBytesSent && !lpOverlapped)
+ {
+ if (lpErrno)
+ *lpErrno = WSAEFAULT;
+ return SOCKET_ERROR;
}
if (!(Socket->SharedData->ServiceFlags1 & XP1_CONNECTIONLESS))