This is an automated email from the ASF dual-hosted git repository.
remm pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push:
new 9651c88542 Use parts size for maxParameterCount
9651c88542 is described below
commit 9651c88542bed66f8c05bc95733f7c95f7c61cf3
Author: remm <[email protected]>
AuthorDate: Tue Aug 8 13:23:35 2023 +0200
Use parts size for maxParameterCount
If parsing the parts first (which is usually not what happens), then the
parts count should affect maxParameterCount. Since the resource use of
parameters is small, allowing maxParameterCount parameters in addition
to the parts is not a noticeable issue. Parsing parameters first is
recommended though.
Report submitted by Matus Madzin.
---
java/org/apache/catalina/connector/Request.java | 6 +++++-
webapps/docs/changelog.xml | 5 +++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/java/org/apache/catalina/connector/Request.java
b/java/org/apache/catalina/connector/Request.java
index 784f271c4c..0f2ee5c046 100644
--- a/java/org/apache/catalina/connector/Request.java
+++ b/java/org/apache/catalina/connector/Request.java
@@ -3087,7 +3087,11 @@ public class Request implements HttpServletRequest {
boolean success = false;
try {
// Set this every time in case limit has been changed via JMX
- parameters.setLimit(getConnector().getMaxParameterCount());
+ int maxParameterCount = getConnector().getMaxParameterCount();
+ if (parts != null && maxParameterCount > 0) {
+ maxParameterCount -= parts.size();
+ }
+ parameters.setLimit(maxParameterCount);
// getCharacterEncoding() may have been overridden to search for
// hidden form field containing request encoding
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index a687302954..49d56867c9 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -120,6 +120,11 @@
<bug>66822</bug>: Use the same naming format in log messages for
Connector instances as the associated ProtocolHandler instance. (markt)
</fix>
+ <fix>
+ The parts count should also lower the actual
+ <code>maxParameterCount</code> used for parsing parameters if parts are
+ parsed first. (remm)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]