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 {
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to