svn commit: r357978 - head/lib/libfetch

Kyle Evans kevans at FreeBSD.org
Sat Feb 15 19:39:51 UTC 2020


Author: kevans
Date: Sat Feb 15 19:39:50 2020
New Revision: 357978
URL: https://svnweb.freebsd.org/changeset/base/357978

Log:
  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

Modified:
  head/lib/libfetch/common.c

Modified: head/lib/libfetch/common.c
==============================================================================
--- head/lib/libfetch/common.c	Sat Feb 15 19:31:40 2020	(r357977)
+++ head/lib/libfetch/common.c	Sat Feb 15 19:39:50 2020	(r357978)
@@ -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 {


More information about the svn-src-head mailing list