From 0c21023bb2b2522540242fe68d4d5e43d535882b Mon Sep 17 00:00:00 2001 From: chaoticgd <43898262+chaoticgd@users.noreply.github.com> Date: Mon, 9 Dec 2024 08:11:30 +0000 Subject: [PATCH] Path: Prevent Path::RealPath from returning '.' and '..' components --- common/FileSystem.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/FileSystem.cpp b/common/FileSystem.cpp index 46940388b4..a73dab6700 100644 --- a/common/FileSystem.cpp +++ b/common/FileSystem.cpp @@ -453,6 +453,11 @@ std::string Path::RealPath(const std::string_view path) } } } + + // If any relative symlinks were resolved, there may be '.' and '..' + // components in the resultant path, which must be removed. + realpath = Path::Canonicalize(realpath); + #endif return realpath;