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
This commit is contained in:
Kyle Evans 2020-02-15 19:39:50 +00:00
parent 0f3fa96016
commit 3dc455e897
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=357978

View file

@ -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 {