Commit dcf25868 authored by Bruno Jesus's avatar Bruno Jesus Committed by Alexandre Julliard

ws2_32: Cope with NULL address in connect() call.

parent 5a06b6b0
......@@ -1731,14 +1731,17 @@ static inline BOOL supported_protocol(int protocol)
/**********************************************************************/
/* Returns the length of the converted address if successful, 0 if it was too small to
* start with.
/* Returns the length of the converted address if successful, 0 if it was too
* small to start with or unknown family or invalid address buffer.
*/
static unsigned int ws_sockaddr_ws2u(const struct WS_sockaddr* wsaddr, int wsaddrlen,
union generic_unix_sockaddr *uaddr)
{
unsigned int uaddrlen = 0;
if (!wsaddr)
return 0;
switch (wsaddr->sa_family)
{
#ifdef HAS_IPX
......
......@@ -5841,6 +5841,11 @@ static void test_events(int useMessages)
goto end;
}
SetLastError(0xdeadbeef);
ret = connect(src, NULL, 0);
ok(ret == SOCKET_ERROR, "expected -1, got %d\n", ret);
ok(GetLastError() == WSAEFAULT, "expected 10014, got %d\n", GetLastError());
ret = connect(src, (struct sockaddr*)&addr, sizeof(addr));
if (ret == SOCKET_ERROR && WSAGetLastError() != WSAEWOULDBLOCK)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment