forked from pool/tomcat
37 lines
1.5 KiB
Diff
37 lines
1.5 KiB
Diff
|
Index: apache-tomcat-9.0.43-src/java/org/apache/catalina/session/FileStore.java
|
||
|
===================================================================
|
||
|
--- apache-tomcat-9.0.43-src.orig/java/org/apache/catalina/session/FileStore.java
|
||
|
+++ apache-tomcat-9.0.43-src/java/org/apache/catalina/session/FileStore.java
|
||
|
@@ -349,13 +349,14 @@ public final class FileStore extends Sto
|
||
|
|
||
|
String filename = id + FILE_EXT;
|
||
|
File file = new File(storageDir, filename);
|
||
|
+ File canonicalFile = file.getCanonicalFile();
|
||
|
|
||
|
// Check the file is within the storage directory
|
||
|
- if (!file.getCanonicalFile().toPath().startsWith(storageDir.getCanonicalFile().toPath())) {
|
||
|
+ if (!canonicalFile.toPath().startsWith(storageDir.getCanonicalFile().toPath())) {
|
||
|
log.warn(sm.getString("fileStore.invalid", file.getPath(), id));
|
||
|
return null;
|
||
|
}
|
||
|
|
||
|
- return file;
|
||
|
+ return canonicalFile;
|
||
|
}
|
||
|
}
|
||
|
Index: apache-tomcat-9.0.43-src/webapps/docs/changelog.xml
|
||
|
===================================================================
|
||
|
--- apache-tomcat-9.0.43-src.orig/webapps/docs/changelog.xml
|
||
|
+++ apache-tomcat-9.0.43-src/webapps/docs/changelog.xml
|
||
|
@@ -118,6 +118,10 @@
|
||
|
Expand coverage of unit tests for JNDIRealm using the UnboundID LDAP SDK
|
||
|
for Java. (markt)
|
||
|
</scode>
|
||
|
+ <fix>
|
||
|
+ Make the calculation of the session storage location more robust when
|
||
|
+ using file based persistent storage. (markt)
|
||
|
+ </fix>
|
||
|
</changelog>
|
||
|
</subsection>
|
||
|
<subsection name="Coyote">
|