From df70f50fdfcc69726f7d8fd186054dbe3e68c57e Mon Sep 17 00:00:00 2001 From: "Admiral H. Curtiss" Date: Fri, 26 Jun 2015 23:43:45 +0200 Subject: [PATCH] GetExeDirectory() shouldn't return paths with /../ in the middle. --- Source/Core/Common/FileUtil.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Source/Core/Common/FileUtil.cpp b/Source/Core/Common/FileUtil.cpp index 4709c011b2..0b4a99bbd7 100644 --- a/Source/Core/Common/FileUtil.cpp +++ b/Source/Core/Common/FileUtil.cpp @@ -731,8 +731,12 @@ std::string& GetExeDirectory() if (DolphinPath.empty()) { TCHAR Dolphin_exe_Path[2048]; + TCHAR Dolphin_exe_Clean_Path[MAX_PATH]; GetModuleFileName(nullptr, Dolphin_exe_Path, 2048); - DolphinPath = TStrToUTF8(Dolphin_exe_Path); + if (_tfullpath(Dolphin_exe_Clean_Path, Dolphin_exe_Path, MAX_PATH) != nullptr) + DolphinPath = TStrToUTF8(Dolphin_exe_Clean_Path); + else + DolphinPath = TStrToUTF8(Dolphin_exe_Path); DolphinPath = DolphinPath.substr(0, DolphinPath.find_last_of('\\')); } return DolphinPath;