瀏覽代碼

KWSys 2016-08-24 (8e643b9b)

Code extracted from:

    http://public.kitware.com/KWSys.git

at commit 8e643b9b5f24d4cac68d59b1e2be9d161fb75974 (master).

Upstream Shortlog
-----------------

Brad King (1):
      8e643b9b SystemTools: Fix crash in GetShortPath
KWSys Upstream 9 年之前
父節點
當前提交
fcc532470a
共有 1 個文件被更改,包括 5 次插入2 次删除
  1. 5 2
      SystemTools.cxx

+ 5 - 2
SystemTools.cxx

@@ -4725,8 +4725,11 @@ bool SystemTools::GetShortPath(const std::string& path, std::string& shortPath)
   std::wstring wtempPath = Encoding::ToWide(tempPath);
   DWORD ret = GetShortPathNameW(wtempPath.c_str(), NULL, 0);
   std::vector<wchar_t> buffer(ret);
-  ret = GetShortPathNameW(wtempPath.c_str(),
-                          &buffer[0], static_cast<DWORD>(buffer.size()));
+  if (ret != 0)
+    {
+    ret = GetShortPathNameW(wtempPath.c_str(),
+                            &buffer[0], static_cast<DWORD>(buffer.size()));
+    }
 
   if (ret == 0)
     {