Skip to content

Commit

Permalink
[UNDERTOW-2334] CVE-2024-6162 AJP Parser: Do not share the decodeBuff…
Browse files Browse the repository at this point in the history
…er StringBuilder instance between requests

Signed-off-by: Flavia Rainone <[email protected]>
  • Loading branch information
TomasHofman authored and fl4via committed Jun 21, 2024
1 parent 79c7734 commit 85d0925
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ public class AjpRequestParser {
private final boolean slashDecodingFlag;
private final int maxParameters;
private final int maxHeaders;
private StringBuilder decodeBuffer;
private final boolean allowUnescapedCharactersInUrl;
private final Pattern allowedRequestAttributesPattern;

Expand Down Expand Up @@ -509,9 +508,7 @@ public void parse(final ByteBuffer buf, final AjpRequestParseState state, final
private String decode(String url, final boolean containsUrlCharacters) throws UnsupportedEncodingException {
if (doDecode && containsUrlCharacters) {
try {
if(decodeBuffer == null) {
decodeBuffer = new StringBuilder();
}
final StringBuilder decodeBuffer = new StringBuilder();
return URLUtils.decode(url, this.encoding, slashDecodingFlag, false, decodeBuffer);
} catch (Exception e) {
throw UndertowMessages.MESSAGES.failedToDecodeURL(url, encoding, e);
Expand Down

0 comments on commit 85d0925

Please sign in to comment.