From 6555d4d51cd442e635be426958bf5aa734ef57e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Thie=C3=9Fen?= Date: Fri, 10 Jan 2020 02:05:15 +0100 Subject: [PATCH] http client: Fix overwite of addrlen for connect if binding to iface The addrlen argument to connect() was overwritten by the lws_socket_bind() result, which is a port number. Fixes https://github.com/warmcat/libwebsockets/issues/1817 --- lib/roles/http/client/client-handshake.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/roles/http/client/client-handshake.c b/lib/roles/http/client/client-handshake.c index c875137d3..15c8a6596 100644 --- a/lib/roles/http/client/client-handshake.c +++ b/lib/roles/http/client/client-handshake.c @@ -566,9 +566,9 @@ ads_known: _WSI_TOKEN_CLIENT_IFACE); if (iface && *iface) { - n = lws_socket_bind(wsi->vhost, wsi->desc.sockfd, 0, + m = lws_socket_bind(wsi->vhost, wsi->desc.sockfd, 0, iface, wsi->ipv6); - if (n < 0) + if (m < 0) goto try_next_result_fds; } }