Blame SOURCES/tomcat-7.0.76-CVE-2018-1304.patch

6f268b
commit 2d69fde135302e8cff984bb2131ec69f2e396964
6f268b
Author: Mark Thomas <markt@apache.org>
6f268b
Date:   Tue Feb 6 11:41:16 2018 +0000
6f268b
6f268b
    git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc7.0.x/trunk@1823309 13f79535-47bb-0310-9956-ffa450edef68
6f268b
6f268b
diff --git a/java/org/apache/catalina/realm/RealmBase.java b/java/org/apache/catalina/realm/RealmBase.java
6f268b
index 2098c2e8cc..9697440d35 100644
6f268b
--- java/org/apache/catalina/realm/RealmBase.java
6f268b
+++ java/org/apache/catalina/realm/RealmBase.java
6f268b
@@ -688,9 +688,9 @@ public abstract class RealmBase extends LifecycleMBeanBase implements Realm {
6f268b
6f268b
         // Check each defined security constraint
6f268b
         String uri = request.getRequestPathMB().toString();
6f268b
-        // Bug47080 - in rare cases this may be null
6f268b
+        // Bug47080 - in rare cases this may be null or ""
6f268b
         // Mapper treats as '/' do the same to prevent NPE
6f268b
-        if (uri == null) {
6f268b
+        if (uri == null || uri.length() == 0) {
6f268b
             uri = "/";
6f268b
         }
6f268b
6f268b
@@ -722,7 +722,8 @@ public abstract class RealmBase extends LifecycleMBeanBase implements Realm {
6f268b
                 }
6f268b
6f268b
                 for(int k=0; k < patterns.length; k++) {
6f268b
-                    if(uri.equals(patterns[k])) {
6f268b
+                    // Exact match including special case for the context root.
6f268b
+                    if(uri.equals(patterns[k]) || patterns[k].length() == 0 && uri.equals("/")) {
6f268b
                         found = true;
6f268b
                         if(collection[j].findMethod(method)) {
6f268b
                             if(results == null) {
6f268b
diff -up webapps/docs/changelog.xml.orig webapps/docs/changelog.xml
6f268b
--- webapps/docs/changelog.xml.orig	2019-02-28 15:11:59.735767416 -0500
6f268b
+++ webapps/docs/changelog.xml	2019-02-28 15:12:23.805697236 -0500
6f268b
@@ -64,6 +64,10 @@
6f268b
         When generating a redirect to a directory in the Default Servlet, avoid
6f268b
         generating a protocol relative redirect. (markt)
6f268b
       </fix>
6f268b
+      <fix>
6f268b
+        <bug>62067</bug>: Correctly apply security constraints mapped to the
6f268b
+        context root using a URL pattern of "". (markt)
6f268b
+      </fix>
6f268b
     </changelog>
6f268b
   </subsection>
6f268b
 </section>