From 2fe97dc274116e8619c8fddd8b5689fe8e76f5c2 Mon Sep 17 00:00:00 2001 From: Jay Satiro Date: Mon, 28 Aug 2023 03:09:18 -0400 Subject: [PATCH] ftp: fix temp write of ipv6 address - During the check to differentiate between a port and IPv6 address without brackets, write the binary IPv6 address to an in6_addr. Prior to this change the binary IPv6 address was erroneously written to a sockaddr_in6 'sa6' when it should have been written to its in6_addr member 'sin6_addr'. There's no fallout because no members of 'sa6' are accessed before it is later overwritten. Closes https://github.com/curl/curl/pull/11747 --- lib/ftp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ftp.c b/lib/ftp.c index adb2ebd99c..e24ae9c15d 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -972,7 +972,7 @@ static CURLcode ftp_state_use_port(struct Curl_easy *data, if(ip_end) { /* either ipv6 or (ipv4|domain|interface):port(-range) */ #ifdef ENABLE_IPV6 - if(Curl_inet_pton(AF_INET6, string_ftpport, sa6) == 1) { + if(Curl_inet_pton(AF_INET6, string_ftpport, &sa6->sin6_addr) == 1) { /* ipv6 */ port_min = port_max = 0; strcpy(addr, string_ftpport); -- 2.47.3