From a3aaca10d9acf4a51d2bf1fb9ea0b933e18e3f33 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 14 Aug 2026 09:48:46 +0200 Subject: [PATCH] multi: cap expire times to INT_MAX internally When the time-out value is passed to the outside world it needs to fit in a signed 32-bit variable (on Windows and 32-bit architectures) anyway. Also, this is 3.5 weeks and we should not knowingly set timeouts that long anyway. The previous cap introduced in 3089e7eec8b694ff was only partial. Closes #22579 --- lib/multi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/multi.c b/lib/multi.c index 037db1af39..a340dfcae1 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -3757,6 +3757,11 @@ void Curl_expire_ex(struct Curl_easy *data, if(!multi) return; DEBUGASSERT(eid < EXPIRE_LAST); + DEBUGASSERT(milli <= INT_MAX); + if(milli > INT_MAX) + /* Cap ridiculous timeouts, 31-bit ms is still 3.5 weeks. When the time + goes to the user, it must fit in this size. */ + milli = INT_MAX; set = *Curl_pgrs_now(data); set.tv_sec += (time_t)(milli / 1000); /* may be a 64 to 32-bit conversion */