]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool_getparam: fix --parallel-max maximum value constraint
authorJustAnotherArchivist <JustAnotherArchivist@users.noreply.github.com>
Sat, 28 May 2022 05:07:02 +0000 (05:07 +0000)
committerJay Satiro <raysatiro@yahoo.com>
Sat, 28 May 2022 07:23:57 +0000 (03:23 -0400)
- Clamp --parallel-max to MAX_PARALLEL (300) instead of resetting to
  default value.

Previously, --parallel-max 300 would use 300 concurrent transfers, but
--parallel-max 301 would unexpectedly use only 50. This change clamps
higher values to the maximum (ie --parallel-max 301 would use 300).

Closes https://github.com/curl/curl/pull/8930

src/tool_getparam.c

index bd459847b3d2ce14c3a9eae28009effda90ca60d..22b0e36706f1b2c977497d51a1a70c070a466bd5 100644 (file)
@@ -2337,8 +2337,9 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
         err = str2unum(&global->parallel_max, nextarg);
         if(err)
           return err;
-        if((global->parallel_max > MAX_PARALLEL) ||
-           (global->parallel_max < 1))
+        if(global->parallel_max > MAX_PARALLEL)
+          global->parallel_max = MAX_PARALLEL;
+        else if(global->parallel_max < 1)
           global->parallel_max = PARALLEL_DEFAULT;
         break;
       case 'c':   /* --parallel-connect */