aboutsummaryrefslogtreecommitdiff
path: root/lib/socks.c
diff options
context:
space:
mode:
authorMarc Hoersken <info@marc-hoersken.de>2016-08-20 21:38:09 +0200
committerMarc Hoersken <info@marc-hoersken.de>2016-08-20 21:38:43 +0200
commitb820e40f340f142b8475721538f768d59dc9c353 (patch)
tree671d16b4ddd4df075d8c308344ff6d22034a9c5c /lib/socks.c
parent670802bd0b88e81490d21accc423957b5dafeffc (diff)
socks.c: display the hostname returned by the SOCKS5 proxy server
Instead of displaying the requested hostname the one returned by the SOCKS5 proxy server is used in case of connection error. The requested hostname is displayed earlier in the connection sequence. The upper-value of the port is moved to a temporary variable and replaced with a 0-byte to make sure the hostname is 0-terminated.
Diffstat (limited to 'lib/socks.c')
-rw-r--r--lib/socks.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/socks.c b/lib/socks.c
index 01607bbaf..1c01a0b93 100644
--- a/lib/socks.c
+++ b/lib/socks.c
@@ -734,12 +734,15 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
(unsigned char)socksreq[1]);
}
else if(socksreq[3] == 3) {
+ unsigned char port_upper = (unsigned char)socksreq[len - 2];
+ socksreq[len - 2] = 0;
failf(data,
"Can't complete SOCKS5 connection to %s:%d. (%d)",
- hostname,
- (((unsigned char)socksreq[len - 2] << 8) |
+ (char *)&socksreq[5],
+ ((port_upper << 8) |
(unsigned char)socksreq[len - 1]),
(unsigned char)socksreq[1]);
+ socksreq[len - 2] = port_upper;
}
else if(socksreq[3] == 4) {
failf(data,