Paul Gofman : ws2_32: Return WSAEFAULT from setsockopt() for IP_TTL with zero optlen.

Alexandre Julliard julliard at winehq.org
Tue Mar 8 16:10:49 CST 2022


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

Author: Paul Gofman <pgofman at codeweavers.com>
Date:   Tue Mar  8 12:22:46 2022 +0300

ws2_32: Return WSAEFAULT from setsockopt() for IP_TTL with zero 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 | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index ed2889b3eb0..e708d0d2f5e 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -3023,6 +3023,11 @@ int WINAPI setsockopt( SOCKET s, int level, int optname, const char *optval, int
             return server_setsockopt( s, IOCTL_AFD_WINE_SET_IP_TOS, optval, optlen );
 
         case IP_TTL:
+            if (!optlen)
+            {
+                SetLastError( WSAEFAULT );
+                return -1;
+            }
             return server_setsockopt( s, IOCTL_AFD_WINE_SET_IP_TTL, optval, optlen );
 
         case IP_UNBLOCK_SOURCE:




More information about the wine-cvs mailing list