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); }