]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool_getparam/set_rate: skip the multiplication on overflow
authorDaniel Stenberg <daniel@haxx.se>
Fri, 19 Sep 2025 15:36:29 +0000 (17:36 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 19 Sep 2025 20:54:57 +0000 (22:54 +0200)
The code detected the problem but didn't avoid the calculation
correctly.

Fixes #18624
Reported-by: BobodevMm on github
Closes #18625

src/tool_getparam.c

index f2ad6daf2ef959e206953f6b5de5016977967e55..b8fec5f7ab3bfad23322b6ea23b4dcf8804f00d3 100644 (file)
@@ -1012,8 +1012,9 @@ static ParameterError set_rate(const char *nextarg)
       errorf("too large --rate unit");
       err = PARAM_NUMBER_TOO_LARGE;
     }
-    /* this typecast is okay based on the check above */
-    numerator *= (long)numunits;
+    else
+      /* this typecast is okay based on the check above */
+      numerator *= (long)numunits;
   }
 
   if(err)