ws2_32: Manage shorter length for IPV6_RECVTCLASS.

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2022-03-11 13:29:51 +03:00 committed by Alexandre Julliard
parent adcff74cd2
commit 91aa6b2828
2 changed files with 12 additions and 0 deletions

View File

@ -1869,6 +1869,12 @@ int WINAPI getsockopt( SOCKET s, int level, int optname, char *optval, int *optl
return server_getsockopt( s, IOCTL_AFD_WINE_GET_IPV6_RECVPKTINFO, optval, optlen );
case IPV6_RECVTCLASS:
if (*optlen < sizeof(DWORD) || !optval)
{
if (optlen) *optlen = 0;
SetLastError( WSAEFAULT );
return SOCKET_ERROR;
}
return server_getsockopt( s, IOCTL_AFD_WINE_GET_IPV6_RECVTCLASS, optval, optlen );
case IPV6_UNICAST_HOPS:
@ -3245,6 +3251,11 @@ int WINAPI setsockopt( SOCKET s, int level, int optname, const char *optval, int
return 0;
case IPV6_RECVTCLASS:
if (optlen < sizeof(DWORD) || !optval)
{
SetLastError( WSAEFAULT );
return SOCKET_ERROR;
}
return server_setsockopt( s, IOCTL_AFD_WINE_SET_IPV6_RECVTCLASS, optval, optlen );
case IPV6_UNICAST_HOPS:

View File

@ -1194,6 +1194,7 @@ static void test_set_getsockopt(void)
{AF_INET6, SOCK_DGRAM, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, TRUE, {1, 1, 4}, {0}, FALSE},
{AF_INET6, SOCK_DGRAM, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, TRUE, {1, 1, 4}, {0}, TRUE, TRUE},
{AF_INET6, SOCK_DGRAM, IPPROTO_IPV6, IPV6_PKTINFO, FALSE, {0, 0, 4}, {0}, TRUE, TRUE},
{AF_INET6, SOCK_DGRAM, IPPROTO_IPV6, IPV6_RECVTCLASS, FALSE, {0, 0, 4}, {0}, TRUE, TRUE},
};
SOCKET s, s2;
int i, j, err, lasterr;