From 3dc455e8974c1a4723f6703f47b2f667a61c934b Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Sat, 15 Feb 2020 19:39:50 +0000 Subject: [PATCH] fetch(3): fix regression in IPv6:port spec from r357977 In case the port was specified, we never actually populated *host. Do so now. Pointy hat: kevans --- lib/libfetch/common.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/libfetch/common.c b/lib/libfetch/common.c index 12da7e6ee988..7dbb032a8067 100644 --- a/lib/libfetch/common.c +++ b/lib/libfetch/common.c @@ -547,18 +547,18 @@ fetch_socks5_getenv(char **host, int *port) if (socks5env[0] == '[') { if (socks5env[slen - 1] == ']') { *host = strndup(socks5env, slen); - if (*host == NULL) - goto fail; - } else if (ext == NULL) { + } else if (ext != NULL) { + *host = strndup(socks5env, ext - socks5env + 1); + } else { socks5_seterr(SOCKS5_ERR_BAD_PROXY_FORMAT); return (0); } } else { *host = strndup(socks5env, ext - socks5env); - if (*host == NULL) - goto fail; } + if (*host == NULL) + goto fail; if (ext == NULL) { *port = 1080; /* Default port as defined in RFC1928 */ } else {