mirror of
https://github.com/curl/curl.git
synced 2026-07-23 18:57:18 +03:00
socks.c: Correctly calculate position of port in response packet
Third commit to fix issue #944 regarding SOCKS5 error handling. Reported-by: David Kalnischkies
This commit is contained in:
parent
cc3384a254
commit
b7ee5316c2
1 changed files with 6 additions and 3 deletions
|
|
@ -719,14 +719,16 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
|
||||||
"Can't complete SOCKS5 connection to %d.%d.%d.%d:%d. (%d)",
|
"Can't complete SOCKS5 connection to %d.%d.%d.%d:%d. (%d)",
|
||||||
(unsigned char)socksreq[4], (unsigned char)socksreq[5],
|
(unsigned char)socksreq[4], (unsigned char)socksreq[5],
|
||||||
(unsigned char)socksreq[6], (unsigned char)socksreq[7],
|
(unsigned char)socksreq[6], (unsigned char)socksreq[7],
|
||||||
(((unsigned char)socksreq[8] << 8) | (unsigned char)socksreq[9]),
|
(((unsigned char)socksreq[8] << 8) |
|
||||||
|
(unsigned char)socksreq[9]),
|
||||||
(unsigned char)socksreq[1]);
|
(unsigned char)socksreq[1]);
|
||||||
}
|
}
|
||||||
else if(socksreq[3] == 3) {
|
else if(socksreq[3] == 3) {
|
||||||
failf(data,
|
failf(data,
|
||||||
"Can't complete SOCKS5 connection to %s:%d. (%d)",
|
"Can't complete SOCKS5 connection to %s:%d. (%d)",
|
||||||
hostname,
|
hostname,
|
||||||
(((unsigned char)socksreq[8] << 8) | (unsigned char)socksreq[9]),
|
(((unsigned char)socksreq[len - 2] << 8) |
|
||||||
|
(unsigned char)socksreq[len - 1]),
|
||||||
(unsigned char)socksreq[1]);
|
(unsigned char)socksreq[1]);
|
||||||
}
|
}
|
||||||
else if(socksreq[3] == 4) {
|
else if(socksreq[3] == 4) {
|
||||||
|
|
@ -741,7 +743,8 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
|
||||||
(unsigned char)socksreq[14], (unsigned char)socksreq[15],
|
(unsigned char)socksreq[14], (unsigned char)socksreq[15],
|
||||||
(unsigned char)socksreq[16], (unsigned char)socksreq[17],
|
(unsigned char)socksreq[16], (unsigned char)socksreq[17],
|
||||||
(unsigned char)socksreq[18], (unsigned char)socksreq[19],
|
(unsigned char)socksreq[18], (unsigned char)socksreq[19],
|
||||||
(((unsigned char)socksreq[8] << 8) | (unsigned char)socksreq[9]),
|
(((unsigned char)socksreq[20] << 8) |
|
||||||
|
(unsigned char)socksreq[21]),
|
||||||
(unsigned char)socksreq[1]);
|
(unsigned char)socksreq[1]);
|
||||||
}
|
}
|
||||||
return CURLE_COULDNT_CONNECT;
|
return CURLE_COULDNT_CONNECT;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue