Don't pass a null ptr at MSAFD to avoid dereference.
Fixes crash in ws2_32:sock

svn path=/trunk/; revision=74992
This commit is contained in:
Pierre Schweitzer 2017-06-11 07:56:18 +00:00
parent fbfe11f633
commit 1bde2edfcb

View file

@ -38,6 +38,8 @@ connect(IN SOCKET s,
{ {
/* Get the Socket Context */ /* Get the Socket Context */
if ((Socket = WsSockGetSocket(s))) if ((Socket = WsSockGetSocket(s)))
{
if (!IsBadReadPtr(name, sizeof(struct sockaddr)))
{ {
while (TRUE) while (TRUE)
{ {
@ -89,6 +91,12 @@ connect(IN SOCKET s,
if (ErrorCode == NO_ERROR) ErrorCode = WSASYSCALLFAILURE; if (ErrorCode == NO_ERROR) ErrorCode = WSASYSCALLFAILURE;
} }
else else
{
/* Invalid user pointer */
ErrorCode = WSAEFAULT;
}
}
else
{ {
/* No Socket Context Found */ /* No Socket Context Found */
ErrorCode = WSAENOTSOCK; ErrorCode = WSAENOTSOCK;