ws2_32: Handle NULL argument in inet_addr.

This commit is contained in:
Hans Leidekker 2007-02-23 15:41:10 +01:00 committed by Alexandre Julliard
parent cdca32c12e
commit bde4e36208
2 changed files with 12 additions and 2 deletions

View File

@ -2175,6 +2175,7 @@ int WINAPI WSAHtons(SOCKET s, WS_u_short hostshort, WS_u_short *lpnetshort)
*/ */
WS_u_long WINAPI WS_inet_addr(const char *cp) WS_u_long WINAPI WS_inet_addr(const char *cp)
{ {
if (!cp) return INADDR_NONE;
return inet_addr(cp); return inet_addr(cp);
} }

View File

@ -1491,7 +1491,7 @@ done:
closesocket(server_socket); closesocket(server_socket);
} }
static void test_extendedSocketOptions() static void test_extendedSocketOptions(void)
{ {
WSADATA wsa; WSADATA wsa;
SOCKET sock; SOCKET sock;
@ -1565,7 +1565,7 @@ static void test_extendedSocketOptions()
WSACleanup(); WSACleanup();
} }
static void test_getsockname() static void test_getsockname(void)
{ {
WSADATA wsa; WSADATA wsa;
SOCKET sock; SOCKET sock;
@ -1612,6 +1612,14 @@ static void test_getsockname()
WSACleanup(); WSACleanup();
} }
static void test_inet_addr(void)
{
u_long addr;
addr = inet_addr(NULL);
ok(addr == INADDR_NONE, "inet_addr succeeded unexpectedly\n");
}
/**************** Main program ***************/ /**************** Main program ***************/
START_TEST( sock ) START_TEST( sock )
@ -1643,6 +1651,7 @@ START_TEST( sock )
test_select(); test_select();
test_accept(); test_accept();
test_getsockname(); test_getsockname();
test_inet_addr();
Exit(); Exit();
} }