From 97ae9ec8efe05bd0d82bbf9ee127c46bfae40c8c Mon Sep 17 00:00:00 2001 From: Jay Satiro Date: Sun, 12 Oct 2025 18:35:22 -0400 Subject: [PATCH] ws: fix type conversion check - Fix logic that checks whether a size_t will fit in a curl_off_t. Reported-by: Viktor Szakats Fixes https://github.com/curl/curl/issues/19017 Closes https://github.com/curl/curl/pull/19036 --- lib/ws.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ws.c b/lib/ws.c index 6c8f07e177..ec79235550 100644 --- a/lib/ws.c +++ b/lib/ws.c @@ -654,8 +654,8 @@ static curl_off_t ws_payload_remain(curl_off_t payload_total, curl_off_t remain = payload_total - payload_offset; if((payload_total < 0) || (payload_offset < 0) || (remain < 0)) return -1; -#if SIZEOF_OFF_T <= SIZEOF_SIZE_T - if((curl_off_t)payload_buffered < 0) +#if SIZEOF_SIZE_T >= SIZEOF_CURL_OFF_T + if(payload_buffered > (size_t)CURL_OFF_T_MAX) return -1; #endif if(remain < (curl_off_t)payload_buffered) -- 2.47.3