Commit 26c26702 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

ws2_32: Manage shorter length for SO_DONTROUTE.

parent a73cb3f1
......@@ -1511,13 +1511,14 @@ int WINAPI getsockopt( SOCKET s, int level, int optname, char *optval, int *optl
/* As mentioned in setsockopt, Windows ignores this, so we
* always return true here */
case SO_DONTROUTE:
if (*optlen < sizeof(BOOL) || !optval)
if (*optlen < 1 || !optval)
{
SetLastError(WSAEFAULT);
SetLastError( WSAEFAULT );
return SOCKET_ERROR;
}
*(BOOL *)optval = TRUE;
*optlen = sizeof(BOOL);
*optval = TRUE;
*optlen = 1;
SetLastError( ERROR_SUCCESS );
return 0;
case SO_ERROR:
......@@ -2859,7 +2860,13 @@ int WINAPI setsockopt( SOCKET s, int level, int optname, const char *optval, int
/* For some reason the game GrandPrixLegends does set SO_DONTROUTE on its
* socket. According to MSDN, this option is silently ignored.*/
case SO_DONTROUTE:
TRACE("Ignoring SO_DONTROUTE\n");
TRACE( "Ignoring SO_DONTROUTE.\n" );
if (optlen <= 0)
{
SetLastError( optlen ? WSAENOBUFS : WSAEFAULT );
return -1;
}
SetLastError( ERROR_SUCCESS );
return 0;
/* Stops two sockets from being bound to the same port. Always happens
......
......@@ -1171,6 +1171,7 @@ static void test_set_getsockopt(void)
{
{AF_INET, SOCK_DGRAM, SOL_SOCKET, SO_BROADCAST, TRUE, {1, 1, 4}, {0, 0xdead0001, 0}, TRUE, TRUE},
{AF_INET, SOCK_STREAM, SOL_SOCKET, SO_DONTLINGER, TRUE, {1, 1, 4}, {0, 0xdead0001, 0}, TRUE, TRUE},
{AF_INET, SOCK_STREAM, SOL_SOCKET, SO_DONTROUTE, TRUE, {1, 1, 1}, {0}, TRUE},
{AF_INET, SOCK_STREAM, SOL_SOCKET, SO_RCVTIMEO, FALSE, {1, 2, 4}, {0}, TRUE},
{AF_INET, SOCK_STREAM, SOL_SOCKET, SO_SNDTIMEO, FALSE, {1, 2, 4}, {0}, TRUE},
{AF_INET, SOCK_DGRAM, IPPROTO_IP, IP_MULTICAST_LOOP, TRUE, {1, 1, 4}, {0}, TRUE, TRUE},
......
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