summaryrefslogtreecommitdiff
path: root/lib/connect.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-08-24 11:07:59 +0200
committerDaniel Stenberg <daniel@haxx.se>2020-08-28 14:16:41 +0200
commita2c85bb8e4ba9fa94b88c7592766763e30379ed2 (patch)
tree1d13ea2d5984bbe625a1cdc33b994bfc00e6815d /lib/connect.c
parent68a51324740945f1da9758bc1d26bbe4835bd847 (diff)
downloadcurl-a2c85bb8e4ba9fa94b88c7592766763e30379ed2.tar.gz
Curl_pgrsTime - return new time to avoid timeout integer overflow
Setting a timeout to INT_MAX could cause an immediate error to get returned as timeout because of an overflow when different values of 'now' were used. This is primarily fixed by having Curl_pgrsTime() return the "now" when TIMER_STARTSINGLE is set so that the parent function will continue using that time. Reported-by: IonuČ›-Francisc Oancea Fixes #5583 Closes #5847
Diffstat (limited to 'lib/connect.c')
-rw-r--r--lib/connect.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/connect.c b/lib/connect.c
index f53266054..8ceb8db62 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -1317,10 +1317,9 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
const struct Curl_dns_entry *remotehost)
{
struct Curl_easy *data = conn->data;
- struct curltime before = Curl_now();
CURLcode result = CURLE_COULDNT_CONNECT;
int i;
- timediff_t timeout_ms = Curl_timeleft(data, &before, TRUE);
+ timediff_t timeout_ms = Curl_timeleft(data, NULL, TRUE);
if(timeout_ms < 0) {
/* a precaution, no need to continue if time already is up */