]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
multi: avoid a theoretical 32-bit wrap
authorDaniel Stenberg <daniel@haxx.se>
Thu, 26 Feb 2026 15:58:15 +0000 (16:58 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 26 Feb 2026 16:14:50 +0000 (17:14 +0100)
If Curl_uint32_tbl_count() at some future point actually can return
UINT_MAX, this fixes the math to not wrap.

Closes #20742

lib/multi.c

index cdfe925cb8df952af65c1867b002cf7ed2f9a9ac..5642978842d2a7fa7b7f2ee552b310a2935098e0 100644 (file)
@@ -3725,7 +3725,7 @@ CURL **curl_multi_get_handles(CURLM *m)
 {
   struct Curl_multi *multi = m;
   void *entry;
-  unsigned int count = Curl_uint32_tbl_count(&multi->xfers);
+  size_t count = Curl_uint32_tbl_count(&multi->xfers);
   CURL **a = curlx_malloc(sizeof(struct Curl_easy *) * (count + 1));
   if(a) {
     unsigned int i = 0;