[PATCH 5/7] ws2_32: Return WSAENOBUFS from setsockopt() for IPPROTO_IPV6 with negative optlen.

Paul Gofman pgofman at codeweavers.com
Thu Mar 10 03:40:56 CST 2022


Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
---
 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:
-- 
2.35.1




More information about the wine-devel mailing list