From c593b2f48edc8810cdd2cde770a23fa8f80a8807 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Tue, 8 Mar 2022 12:22:44 +0300 Subject: [PATCH] ws2_32: Return WSAEFAULT from setsockopt() for IP_MULTICAST_LOOP with zero optlen. Signed-off-by: Paul Gofman Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/ws2_32/socket.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index dacb41a0403..816ca828b90 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -2981,6 +2981,11 @@ int WINAPI setsockopt( SOCKET s, int level, int optname, const char *optval, int return server_setsockopt( s, IOCTL_AFD_WINE_SET_IP_MULTICAST_IF, optval, optlen ); case IP_MULTICAST_LOOP: + if (!optlen) + { + SetLastError( WSAEFAULT ); + return -1; + } return server_setsockopt( s, IOCTL_AFD_WINE_SET_IP_MULTICAST_LOOP, optval, optlen ); case IP_MULTICAST_TTL: