From 10cd69623a544c83bae6d90acdf141981ae53174 Mon Sep 17 00:00:00 2001 From: JustAnotherArchivist Date: Sat, 28 May 2022 05:07:02 +0000 Subject: [PATCH] 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 --- src/tool_getparam.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 */ -- 2.47.3