Paul Gofman : ws2_32: Return WSAENOBUFS from setsockopt() for IPPROTO_IP with negative optlen.

Alexandre Julliard julliard at winehq.org
Mon Mar 7 16:04:58 CST 2022


Module: wine
Branch: master
Commit: 9744055cf4d1c53ea5ca611ccb3c3b8e471e5147
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=9744055cf4d1c53ea5ca611ccb3c3b8e471e5147

Author: Paul Gofman <pgofman at codeweavers.com>
Date:   Sat Mar  5 22:04:06 2022 +0300

ws2_32: Return WSAENOBUFS from setsockopt() for IPPROTO_IP with negative optlen.

Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 efc0a5b488a..40d86becef9 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -2946,6 +2946,12 @@ int WINAPI setsockopt( SOCKET s, int level, int optname, const char *optval, int
         break;
 
     case IPPROTO_IP:
+        if (optlen < 0)
+        {
+            SetLastError(WSAENOBUFS);
+            return SOCKET_ERROR;
+        }
+
         switch(optname)
         {
         case IP_ADD_MEMBERSHIP:




More information about the wine-cvs mailing list