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


The following commit(s) were added to refs/heads/master by this push:
     new 14cc26c  Fix path validation when docBase="/"
14cc26c is described below

commit 14cc26c247f95a14912268ebc26abe618bd7511c
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue Aug 25 10:01:50 2020 +0100

    Fix path validation when docBase="/"
---
 .../org/apache/catalina/webresources/AbstractFileResourceSet.java | 8 ++++++++
 webapps/docs/changelog.xml                                        | 5 +++++
 2 files changed, 13 insertions(+)

diff --git a/java/org/apache/catalina/webresources/AbstractFileResourceSet.java 
b/java/org/apache/catalina/webresources/AbstractFileResourceSet.java
index b79f88b..c799341 100644
--- a/java/org/apache/catalina/webresources/AbstractFileResourceSet.java
+++ b/java/org/apache/catalina/webresources/AbstractFileResourceSet.java
@@ -212,6 +212,14 @@ public abstract class AbstractFileResourceSet extends 
AbstractResourceSet {
         } catch (IOException e) {
             throw new IllegalArgumentException(e);
         }
+
+        // Need to handle mapping of the file system root as a special case
+        if ("/".equals(this.absoluteBase)) {
+            this.absoluteBase = "";
+        }
+        if ("/".equals(this.canonicalBase)) {
+            this.canonicalBase = "";
+        }
     }
 
 
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 987fb3b..9931b8a 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -88,6 +88,11 @@
         associated code for clarity.
         Based on a patch provided by Milo van der Zee. (markt)
       </fix>
+      <fix>
+        Correct the path vaidation to allow the use of the file system root for
+        the <code>docBase</code> attribute of a <code>Context</code>. Note that
+        such a configuration should be used with caution. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">


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

Reply via email to