ws2_32: WSAAddressToStringW should return length of unicode address string should and include the trailing null.

This commit is contained in:
Jeff Latimer 2009-04-17 14:30:53 +10:00 committed by Alexandre Julliard
parent bf40710516
commit eab59e84ac
2 changed files with 4 additions and 1 deletions

View File

@ -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;
}

View File

@ -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)