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-24 11:07:59 +0200
commit863095f2bcf25d2b0243ad5c67735c04deff4241 (patch)
tree79a510285513d9eb5fa0ad376b31da5bbe86c6f4 /lib/connect.c
parent98c94596f5928840177b6bd3c7b0f0dd03a431af (diff)
downloadcurl-bagder/timeout-overflow.tar.gz
Curl_pgrsTime - return new time to avoid timeout integer overflowbagder/timeout-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
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 */