This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new 70da1aa Make calculation of session storage location more robust
70da1aa is described below
commit 70da1aaa51e0f9d088438e9d958812a144e12754
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Jan 12 11:11:29 2022 +0000
Make calculation of session storage location more robust
---
java/org/apache/catalina/session/FileStore.java | 5 +++--
webapps/docs/changelog.xml | 4 ++++
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/java/org/apache/catalina/session/FileStore.java
b/java/org/apache/catalina/session/FileStore.java
index 3d13fde..1aba87e 100644
--- a/java/org/apache/catalina/session/FileStore.java
+++ b/java/org/apache/catalina/session/FileStore.java
@@ -349,13 +349,14 @@ public final class FileStore extends StoreBase {
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;
}
}
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index b6fb171..a2bff80 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -120,6 +120,10 @@
Add recycling check in the input and output stream isReady to try to
give a more informative ISE when the facade has been recycled. (remm)
</fix>
+ <fix>
+ Make the calculation of the session storage location more robust when
+ using file based persistent storage. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]