From 61e58885f48f7519a6a546922f14d8a35be3501e Mon Sep 17 00:00:00 2001 From: namowen Date: Tue, 25 Jul 2017 17:14:37 +0800 Subject: [PATCH] client: ipv6 reject when lws_getaddrinfo46 failed https://github.com/warmcat/libwebsockets/issues/978 --- lib/client-handshake.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/client-handshake.c b/lib/client-handshake.c index 42d1a9b..6ae27d2 100644 --- a/lib/client-handshake.c +++ b/lib/client-handshake.c @@ -111,6 +111,14 @@ lws_client_connect_2(struct lws *wsi) #ifdef LWS_USE_IPV6 if (wsi->ipv6) { + if (n) { + /* lws_getaddrinfo46 failed, there is no usable result */ + lwsl_notice("%s: lws_getaddrinfo46 failed %d\n", + __func__, n); + cce = "ipv6 lws_getaddrinfo46 failed"; + goto oom4; + } + memset(&sa46, 0, sizeof(sa46)); sa46.sa6.sin6_family = AF_INET6; -- 2.7.4