From ba848da71c523d94950d3c53c19ea155189df9dc Mon Sep 17 00:00:00 2001 From: Mark Thomas Date: Tue, 11 Apr 2023 16:41:44 +0100 Subject: [PATCH] Fix parameter counting logic --- java/org/apache/tomcat/util/http/Parameters.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java/org/apache/tomcat/util/http/Parameters.java b/java/org/apache/tomcat/util/http/Parameters.java index d4cc5868b15c..debf968acf0b 100644 --- a/java/org/apache/tomcat/util/http/Parameters.java +++ b/java/org/apache/tomcat/util/http/Parameters.java @@ -201,13 +201,13 @@ public void addParameter(String key, String value) throws IllegalStateException return; } - parameterCount++; - if (limit > -1 && parameterCount > limit) { + if (limit > -1 && parameterCount >= limit) { // Processing this parameter will push us over the limit. ISE is // what Request.parseParts() uses for requests that are too big setParseFailedReason(FailReason.TOO_MANY_PARAMETERS); throw new IllegalStateException(sm.getString("parameters.maxCountFail", Integer.valueOf(limit))); } + parameterCount++; paramHashValues.computeIfAbsent(key, k -> new ArrayList<>(1)).add(value); }