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

ws2_32: WSAAddressToStringA should return length of ANSI address string and…

ws2_32: WSAAddressToStringA should return length of ANSI address string and should include the trailing null.
parent fcde02f9
......@@ -4805,7 +4805,7 @@ INT WINAPI WSAAddressToStringA( LPSOCKADDR sockaddr, DWORD len,
p = strchr( buffer, ':' );
if (!((SOCKADDR_IN *)sockaddr)->sin_port) *p = 0;
size = strlen( buffer );
size = strlen( buffer ) + 1;
if (*lenstr < size)
{
......@@ -4814,6 +4814,7 @@ INT WINAPI WSAAddressToStringA( LPSOCKADDR sockaddr, DWORD len,
return SOCKET_ERROR;
}
*lenstr = size;
strcpy( string, buffer );
return 0;
}
......
......@@ -1296,6 +1296,7 @@ static void test_WSAAddressToStringA(void)
ok( !ret, "WSAAddressToStringA() failed unexpectedly: %d\n", WSAGetLastError() );
ok( !strcmp( address, expect1 ), "Expected: %s, got: %s\n", expect1, address );
ok( len == sizeof( expect1 ), "Expected size to be %d, got %d\n", sizeof( expect1 ), len);
len = sizeof(address);
......@@ -1329,6 +1330,7 @@ static void test_WSAAddressToStringA(void)
ok( !ret, "WSAAddressToStringA() failed unexpectedly: %d\n", WSAGetLastError() );
ok( !strcmp( address, expect4 ), "Expected: %s, got: %s\n", expect4, address );
ok( len == sizeof( expect4 ), "Expected size to be %d, got %d\n", sizeof( expect4 ), len);
}
static void test_WSAAddressToStringW(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