You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rz...@apache.org on 2023/04/26 18:04:41 UTC

[tomee] 05/06: Ports "Fix parameter counting logic" from https://github.com/apache/tomcat/commit/ba848da71c523d94950d3c53c19ea155189df9dc

This is an automated email from the ASF dual-hosted git repository.

rzo1 pushed a commit to branch tomee-9.x
in repository https://gitbox.apache.org/repos/asf/tomee.git

commit fb1276a29007ccf1bbb462f0c6064e5c3e239ecf
Author: Richard Zowalla <ri...@hs-heilbronn.de>
AuthorDate: Wed Apr 19 14:35:14 2023 +0200

    Ports "Fix parameter counting logic" from https://github.com/apache/tomcat/commit/ba848da71c523d94950d3c53c19ea155189df9dc
---
 .../src/patch/java/org/apache/tomcat/util/http/Parameters.java       | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tomee/apache-tomee/src/patch/java/org/apache/tomcat/util/http/Parameters.java b/tomee/apache-tomee/src/patch/java/org/apache/tomcat/util/http/Parameters.java
index bd86844b97..d1a2bff1e6 100644
--- a/tomee/apache-tomee/src/patch/java/org/apache/tomcat/util/http/Parameters.java
+++ b/tomee/apache-tomee/src/patch/java/org/apache/tomcat/util/http/Parameters.java
@@ -206,14 +206,15 @@ public final class Parameters {
             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);
     }