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