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 4a5766f commit d53d8e7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions java/org/apache/tomcat/util/http/Parameters.java
Original file line number Diff line number Diff line change
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 d53d8e7

Please sign in to comment.