Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential mitigation for WW-5466 #1068

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JCgH4164838Gh792C124B5
Copy link
Contributor

Hello Apache Struts Team.

This is a proposed mitigation for WW-5466. It is unlikely that many users will encounter it given the default configuration normally sets struts.multipart.maxStringLength .

The proposed change is a basic guard, combined with some additional unit tests to confirm that processing works both when the configuration values have not been set, as well as when they have been set.

Please advise if anyone thinks the change should be considered, or needs additional consideration.

- Fix for boundary condition bug in JakartaMultipartRequest that results
in a NPE when struts.multipart.maxStringLength is not explicitly set, and
normal fields are processed along with a file upload.
- Additional unit tests for file upload interceptors to confirm
functionality with-or-without max parameters being set when a file upload
is processed alone as well as with normal fields.
@@ -142,7 +142,7 @@ protected void processNormalFormField(FileItem item, String charset) throws Unsu
}

long size = item.getSize();
if (size > maxStringLength) {
if (maxStringLength != null && size > maxStringLength) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants