You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2019/07/02 16:28:13 UTC

[tomcat] 02/02: Once a URI is identified as invalid don't attempt to process it further.

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

markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit c4136dfe2b71dc58b120591857ff21beee7e9c10
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Jul 2 17:27:20 2019 +0100

    Once a URI is identified as invalid don't attempt to process it further.
    
    Based on a PR by Alex Repert.
---
 java/org/apache/catalina/connector/CoyoteAdapter.java | 15 ++++++++-------
 webapps/docs/changelog.xml                            |  4 ++++
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/java/org/apache/catalina/connector/CoyoteAdapter.java b/java/org/apache/catalina/connector/CoyoteAdapter.java
index c996803..3c28c13 100644
--- a/java/org/apache/catalina/connector/CoyoteAdapter.java
+++ b/java/org/apache/catalina/connector/CoyoteAdapter.java
@@ -637,13 +637,14 @@ public class CoyoteAdapter implements Adapter {
                 response.sendError(400, "Invalid URI: " + ioe.getMessage());
             }
             // Normalization
-            if (!normalize(req.decodedURI())) {
-                response.sendError(400, "Invalid URI");
-            }
-            // Character decoding
-            convertURI(decodedURI, request);
-            // Check that the URI is still normalized
-            if (!checkNormalize(req.decodedURI())) {
+            if (normalize(req.decodedURI())) {
+                // Character decoding
+                convertURI(decodedURI, request);
+                // Check that the URI is still normalized
+                if (!checkNormalize(req.decodedURI())) {
+                    response.sendError(400, "Invalid URI");
+                }
+            } else {
                 response.sendError(400, "Invalid URI");
             }
         } else {
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 4764c97..bcce219 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -85,6 +85,10 @@
         Fix typo in UTF-32LE charset name. Patch by zhanhb vi Github.
         (fschumacher)
       </fix>
+      <fix>
+        Once a URI is identified as invalid don't attempt to process it further.
+        Based on a PR by Alex Repert. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Jasper">


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org