From 46332aa0345a858556ccc7bddb2163a4e7d64abc 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: Make sure Path::RealPath returns paths with no '..' components --- common/FileSystem.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/FileSystem.cpp b/common/FileSystem.cpp index 9be8f7e6a7737..0ce135a187dd0 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 '..' components in + // the resultant path, which must be removed. + realpath = Path::Canonicalize(realpath); + #endif return realpath;