Commit eab59e84 authored by Jeff Latimer's avatar Jeff Latimer Committed by Alexandre Julliard

ws2_32: WSAAddressToStringW should return length of unicode address string…

ws2_32: WSAAddressToStringW should return length of unicode address string should and include the trailing null.
parent bf407105
......@@ -4868,7 +4868,7 @@ INT WINAPI WSAAddressToStringW( LPSOCKADDR sockaddr, DWORD len,
p = strchrW( buffer, ':' );
if (!((SOCKADDR_IN *)sockaddr)->sin_port) *p = 0;
size = strlenW( buffer );
size = strlenW( buffer ) + 1;
if (*lenstr < size)
{
......@@ -4876,6 +4876,7 @@ INT WINAPI WSAAddressToStringW( LPSOCKADDR sockaddr, DWORD len,
return SOCKET_ERROR;
}
*lenstr = size;
lstrcpyW( string, buffer );
return 0;
}
......
......@@ -1369,6 +1369,7 @@ static void test_WSAAddressToStringW(void)
ok( !ret, "WSAAddressToStringW() failed unexpectedly: %d\n", WSAGetLastError() );
ok( !lstrcmpW( address, expect1 ), "Expected different address string\n" );
ok( len == sizeof( expect1 )/sizeof( WCHAR ), "Expected size to be %d, got %d\n", sizeof( expect1 )/sizeof( WCHAR ), len);
len = sizeof(address);
......@@ -1402,6 +1403,7 @@ static void test_WSAAddressToStringW(void)
ok( !ret, "WSAAddressToStringW() failed unexpectedly: %d\n", WSAGetLastError() );
ok( !lstrcmpW( address, expect4 ), "Expected different address string\n" );
ok( len == sizeof( expect4 )/sizeof( WCHAR ), "Expected size to be %d, got %d\n", sizeof( expect4 )/sizeof( WCHAR ), len);
}
static void test_WSAStringToAddressA(void)
......
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