Commit 666eb2c6 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

ws2_32: Manage shorter length for SO_BROADCAST.

parent 8fef57b1
...@@ -1419,7 +1419,9 @@ int WINAPI getsockopt( SOCKET s, int level, int optname, char *optval, int *optl ...@@ -1419,7 +1419,9 @@ int WINAPI getsockopt( SOCKET s, int level, int optname, char *optval, int *optl
return server_getsockopt( s, IOCTL_AFD_WINE_GET_SO_ACCEPTCONN, optval, optlen ); return server_getsockopt( s, IOCTL_AFD_WINE_GET_SO_ACCEPTCONN, optval, optlen );
case SO_BROADCAST: case SO_BROADCAST:
return server_getsockopt( s, IOCTL_AFD_WINE_GET_SO_BROADCAST, optval, optlen ); ret = server_getsockopt( s, IOCTL_AFD_WINE_GET_SO_BROADCAST, optval, optlen );
if (!ret && *optlen < sizeof(DWORD)) *optlen = 1;
return ret;
case SO_BSP_STATE: case SO_BSP_STATE:
{ {
...@@ -2794,8 +2796,13 @@ int WINAPI setsockopt( SOCKET s, int level, int optname, const char *optval, int ...@@ -2794,8 +2796,13 @@ int WINAPI setsockopt( SOCKET s, int level, int optname, const char *optval, int
switch(optname) switch(optname)
{ {
case SO_BROADCAST: case SO_BROADCAST:
return server_setsockopt( s, IOCTL_AFD_WINE_SET_SO_BROADCAST, optval, optlen ); if (!optval)
{
SetLastError( WSAEFAULT );
return SOCKET_ERROR;
}
memcpy( &value, optval, min( optlen, sizeof(value) ));
return server_setsockopt( s, IOCTL_AFD_WINE_SET_SO_BROADCAST, (char *)&value, sizeof(value) );
case SO_DONTLINGER: case SO_DONTLINGER:
{ {
struct linger linger; struct linger linger;
......
...@@ -1169,6 +1169,7 @@ static void test_set_getsockopt(void) ...@@ -1169,6 +1169,7 @@ static void test_set_getsockopt(void)
} }
test_optsize[] = test_optsize[] =
{ {
{AF_INET, SOCK_DGRAM, SOL_SOCKET, SO_BROADCAST, TRUE, {1, 1, 4}, {0, 0xdead0001, 0}, TRUE, TRUE},
{AF_INET, SOCK_STREAM, SOL_SOCKET, SO_RCVTIMEO, FALSE, {1, 2, 4}, {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_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}, {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