From: JustAnotherArchivist Date: Sat, 28 May 2022 05:07:02 +0000 (+0000) Subject: tool_getparam: fix --parallel-max maximum value constraint X-Git-Tag: curl-7_84_0~127 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=10cd69623a544c83bae6d90acdf141981ae53174;p=thirdparty%2Fcurl.git tool_getparam: fix --parallel-max maximum value constraint - 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 --- diff --git a/src/tool_getparam.c b/src/tool_getparam.c index bd459847b3..22b0e36706 100644 --- a/src/tool_getparam.c +++ b/src/tool_getparam.c @@ -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 */