1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00

socks.c: Do not modify and invalidate calculated response length

Second commit to fix issue #944 regarding SOCKS5 error handling.

Reported-by: David Kalnischkies
This commit is contained in:
Marc Hoersken 2016-08-14 17:05:32 +02:00
parent 59580e12ba
commit cc3384a254

View File

@ -702,10 +702,9 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
/* decrypt_gssapi_blockread already read the whole packet */ /* decrypt_gssapi_blockread already read the whole packet */
#endif #endif
if(len > 10) { if(len > 10) {
len -= 10;
result = Curl_blockread_all(conn, sock, (char *)&socksreq[10], result = Curl_blockread_all(conn, sock, (char *)&socksreq[10],
len, &actualread); len - 10, &actualread);
if(result || (len != actualread)) { if(result || ((len - 10) != actualread)) {
failf(data, "Failed to receive SOCKS5 connect request ack."); failf(data, "Failed to receive SOCKS5 connect request ack.");
return CURLE_COULDNT_CONNECT; return CURLE_COULDNT_CONNECT;
} }