瀏覽代碼

Bug 1942: Failure when looking for PuTTY key tools and the PATH contain invalid paths

https://winscp.net/tracker/1942
(cherry picked from commit 8537cc6702db6e80c1f6ebb28fc6342fd1a52e54)

Source commit: 48bd7997dcb842ac2490e68f8cc8acea87b4a1b5
Martin Prikryl 4 年之前
父節點
當前提交
04ad9ab747
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      source/windows/GUITools.cpp

+ 2 - 1
source/windows/GUITools.cpp

@@ -80,7 +80,8 @@ bool __fastcall FindFile(UnicodeString & Path)
         while (!Result && !Paths.IsEmpty())
         {
           UnicodeString P = CutToChar(Paths, L';', false);
-          NewPath = TPath::Combine(P, Path);
+          // Not using TPath::Combine as it throws on an invalid path and PATH is not under our control
+          NewPath = IncludeTrailingBackslash(P) + Path;
           Result = FileExistsFix(NewPath);
           if (Result)
           {