Paul Gofman : ws2_32: Consider socket with zero ifindex unbound.

Alexandre Julliard julliard at winehq.org
Fri Jul 3 14:36:17 CDT 2020


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

Author: Paul Gofman <pgofman at codeweavers.com>
Date:   Fri Jul  3 17:30:09 2020 +0300

ws2_32: Consider socket with zero ifindex unbound.

Real interface index can't be zero.
getsockopt(..., IP_UNICAST_IF, ...) may return success and zero
interface index if IP_UNICAST_IF was never set.

Avoids error output which doesn't inidcate a real error condition
for such case.

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

---

 dlls/ws2_32/socket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 402ee86d96..69fbb37af2 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -3788,7 +3788,7 @@ static void interface_bind_check(int fd, struct sockaddr_in *addr)
     ret = getsockopt(fd, IPPROTO_IP, IP_UNICAST_IF, &ifindex, &len);
     if (!ret) ifindex = ntohl(ifindex);
 #endif
-    if (!ret)
+    if (!ret && ifindex)
     {
         EnterCriticalSection(&cs_if_addr_cache);
         if (ifindex < if_addr_cache_size)




More information about the wine-cvs mailing list