From fbfa09650671d97d85bb4e02c1bc232f776209d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20R=C3=BChsen?= Date: Mon, 1 Apr 2024 15:43:45 +0200 Subject: [PATCH] * libwget/net.c (wget_tcp_connect): Fix return code on resolve failure --- libwget/net.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libwget/net.c b/libwget/net.c index a8873cc3..8fc6d143 100644 --- a/libwget/net.c +++ b/libwget/net.c @@ -754,6 +754,10 @@ int wget_tcp_connect(wget_tcp *tcp, const char *host, uint16_t port) tcp->addrinfo = wget_dns_resolve(tcp->dns, host, port, tcp->family, tcp->preferred_family); tcp->remote_port = port; + if (!tcp->addrinfo) { + return WGET_E_CONNECT; + } + for (ai = tcp->addrinfo; ai; ai = ai->ai_next) { // Skip non-TCP sockets if (ai->ai_socktype != SOCK_STREAM)