]> granicus.if.org Git - curl/commitdiff
socks.c: Do not modify and invalidate calculated response length
authorMarc Hoersken <info@marc-hoersken.de>
Sun, 14 Aug 2016 15:05:32 +0000 (17:05 +0200)
committerMarc Hoersken <info@marc-hoersken.de>
Sun, 14 Aug 2016 15:05:32 +0000 (17:05 +0200)
Second commit to fix issue #944 regarding SOCKS5 error handling.

Reported-by: David Kalnischkies
lib/socks.c

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