Alex Wilson <a...@cooperi.net> writes: [...]
> This patch seems to fix it, with some quick testing (with and without proxy). Thanks for your patch, which looks fine. Here's a tweaked version that allocates and frees sslhost in both proxy and non-proxy cases. ok? Index: fetch.c =================================================================== RCS file: /cvs/src/usr.bin/ftp/fetch.c,v retrieving revision 1.126 diff -u -p -p -u -r1.126 fetch.c --- fetch.c 14 Jul 2014 09:26:27 -0000 1.126 +++ fetch.c 21 Aug 2014 12:02:33 -0000 @@ -343,6 +343,10 @@ noslash: } path = newline; + } else if (ishttpsurl) { + sslhost = strdup(host); + if (sslhost == NULL) + errx(1, "Can't allocate memory for https path/host."); } if (isfileurl) { @@ -604,7 +608,7 @@ again: ressl_error(ssl)); goto cleanup_url_get; } - if (ressl_connect_socket(ssl, s, host) != 0) { + if (ressl_connect_socket(ssl, s, sslhost) != 0) { fprintf(ttyout, "SSL failure: %s\n", ressl_error(ssl)); goto cleanup_url_get; } @@ -975,6 +979,7 @@ cleanup_url_get: ressl_free(ssl); } free(full_host); + free(sslhost); free(credentials); #endif /* !SMALL */ if (fin != NULL) -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE