setopt: fix checking range for CURLOPT_MAXCONNECTS

- Use upper limit INT_MAX instead of UINT_MAX.

UINT_MAX doesn't work as the max value for the variable since it is
passed as a long and becomes -1 on platforms that have same sized
int and long, like Windows.

Closes https://github.com/curl/curl/pull/20414
This commit is contained in:
Michał Antoniak 2026-01-23 16:51:44 +01:00 committed by Jay Satiro
parent 7c3a4a4b4c
commit 55ea2b424d

View File

@ -851,9 +851,9 @@ static CURLcode setopt_long_net(struct Curl_easy *data, CURLoption option,
s->dns_cache_timeout_ms = -1;
break;
case CURLOPT_MAXCONNECTS:
result = value_range(&arg, 1, 1, UINT_MAX);
result = value_range(&arg, 1, 1, INT_MAX);
if(!result)
s->maxconnects = (unsigned int)arg;
s->maxconnects = (uint32_t)arg;
break;
case CURLOPT_SERVER_RESPONSE_TIMEOUT:
return setopt_set_timeout_sec(&s->server_response_timeout, arg);