Jinoh Kang : ntdll/unix: Zero-extend IP_TOS byte to INT.

Alexandre Julliard julliard at winehq.org
Wed Jan 19 15:57:46 CST 2022


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

Author: Jinoh Kang <jinoh.kang.kr at gmail.com>
Date:   Wed Jan 19 04:27:37 2022 +0900

ntdll/unix: Zero-extend IP_TOS byte to INT.

The IP_TOS control data is 1 byte on Unix, but 4 bytes on Windows.
Properly zero-extend the value instead of copying 3 bytes of garbage.

Signed-off-by: Jinoh Kang <jinoh.kang.kr at gmail.com>
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntdll/unix/socket.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/dlls/ntdll/unix/socket.c b/dlls/ntdll/unix/socket.c
index f82c7ae1ddf..71dfcdd1114 100644
--- a/dlls/ntdll/unix/socket.c
+++ b/dlls/ntdll/unix/socket.c
@@ -429,8 +429,9 @@ static int convert_control_headers(struct msghdr *hdr, WSABUF *control)
 #if defined(IP_TOS)
                     case IP_TOS:
                     {
+                        INT tos = *(unsigned char *)CMSG_DATA(cmsg_unix);
                         ptr = fill_control_message( WS_IPPROTO_IP, WS_IP_TOS, ptr, &ctlsize,
-                                                    CMSG_DATA(cmsg_unix), sizeof(INT) );
+                                                    &tos, sizeof(INT) );
                         if (!ptr) goto error;
                         break;
                     }




More information about the wine-cvs mailing list