From ab8b7ed54962d93e8aa8e4a019c9672c1bc098b4 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Thu, 10 Mar 2022 12:40:56 +0300 Subject: [PATCH] ws2_32: Return WSAENOBUFS from setsockopt() for IPPROTO_IPV6 with negative optlen. Signed-off-by: Paul Gofman Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/ws2_32/socket.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index ab0c81b311a..c666c758af2 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -3149,6 +3149,12 @@ int WINAPI setsockopt( SOCKET s, int level, int optname, const char *optval, int break; case IPPROTO_IPV6: + if (optlen < 0) + { + SetLastError( WSAENOBUFS ); + return SOCKET_ERROR; + } + switch(optname) { case IPV6_ADD_MEMBERSHIP: