Commit 67ebbbf3 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

ws2_32: Manage shorter length for IPV6_MULTICAST_HOPS.

parent 0fc5a077
......@@ -1828,6 +1828,12 @@ int WINAPI getsockopt( SOCKET s, int level, int optname, char *optval, int *optl
return server_getsockopt( s, IOCTL_AFD_WINE_GET_IPV6_RECVHOPLIMIT, optval, optlen );
case IPV6_MULTICAST_HOPS:
if (*optlen < 1 || !optval)
{
SetLastError( WSAEFAULT );
return SOCKET_ERROR;
}
if (*optlen < sizeof(DWORD)) *optlen = 1;
return server_getsockopt( s, IOCTL_AFD_WINE_GET_IPV6_MULTICAST_HOPS, optval, optlen );
case IPV6_MULTICAST_IF:
......@@ -3193,7 +3199,13 @@ int WINAPI setsockopt( SOCKET s, int level, int optname, const char *optval, int
return server_setsockopt( s, IOCTL_AFD_WINE_SET_IPV6_RECVHOPLIMIT, optval, optlen );
case IPV6_MULTICAST_HOPS:
return server_setsockopt( s, IOCTL_AFD_WINE_SET_IPV6_MULTICAST_HOPS, optval, optlen );
if (!optlen || !optval)
{
SetLastError( WSAEFAULT );
return SOCKET_ERROR;
}
memcpy( &value, optval, min( optlen, sizeof(value) ));
return server_setsockopt( s, IOCTL_AFD_WINE_SET_IPV6_MULTICAST_HOPS, (char *)&value, sizeof(value) );
case IPV6_MULTICAST_IF:
return server_setsockopt( s, IOCTL_AFD_WINE_SET_IPV6_MULTICAST_IF, optval, optlen );
......
......@@ -1191,6 +1191,7 @@ static void test_set_getsockopt(void)
{AF_INET, SOCK_DGRAM, IPPROTO_IP, IP_TTL, TRUE, {1, 1, 4}, {0}, FALSE},
{AF_INET6, SOCK_STREAM, IPPROTO_IPV6, IPV6_DONTFRAG, TRUE, {1, 1, 4}, {0}, TRUE, TRUE},
{AF_INET6, SOCK_DGRAM, IPPROTO_IPV6, IPV6_HOPLIMIT, FALSE, {0, 0, 4}, {0}, TRUE, TRUE},
{AF_INET6, SOCK_DGRAM, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, TRUE, {1, 1, 4}, {0}, FALSE},
};
SOCKET s, s2;
int i, j, err, lasterr;
......
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