Skip to content

Commit

Permalink
Fix parameter counting logic
Browse files Browse the repository at this point in the history
  • Loading branch information
markt-asf committed Apr 11, 2023
1 parent 98016a0 commit fbd8142
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions java/org/apache/tomcat/util/http/Parameters.java
Expand Up @@ -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);
}
Expand Down

0 comments on commit fbd8142

Please sign in to comment.