Piotr Caban : msvcrt: Add support for quoted paths in _wsearchenv_s.

Alexandre Julliard julliard at winehq.org
Wed Jan 29 16:24:07 CST 2020


Module: wine
Branch: master
Commit: f05549b7f71740362ae5ef6dc8d5e846f8c41f0b
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=f05549b7f71740362ae5ef6dc8d5e846f8c41f0b

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Wed Jan 29 13:42:19 2020 +0100

msvcrt: Add support for quoted paths in _wsearchenv_s.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvcrt/dir.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/dlls/msvcrt/dir.c b/dlls/msvcrt/dir.c
index 83aff8bcb5..5bd8fb1b15 100644
--- a/dlls/msvcrt/dir.c
+++ b/dlls/msvcrt/dir.c
@@ -1833,12 +1833,27 @@ int CDECL MSVCRT__wsearchenv_s(const MSVCRT_wchar_t* file, const MSVCRT_wchar_t*
   for(; *penv; penv = (*end ? end + 1 : end))
   {
     end = penv;
-    while(*end && *end != ';') end++; /* Find end of next path */
-    path_len = end - penv;
+    path_len = 0;
+    while(*end && *end != ';' && path_len < MAX_PATH)
+    {
+        if (*end == '"')
+        {
+            end++;
+            while(*end && *end != '"' && path_len < MAX_PATH)
+            {
+                path[path_len++] = *end;
+                end++;
+            }
+            if (*end == '"') end++;
+            continue;
+        }
+
+        path[path_len++] = *end;
+        end++;
+    }
     if (!path_len || path_len >= MAX_PATH)
       continue;
 
-    memcpy(path, penv, path_len * sizeof(MSVCRT_wchar_t));
     if (path[path_len - 1] != '/' && path[path_len - 1] != '\\')
       path[path_len++] = '\\';
     if (path_len + fname_len >= MAX_PATH)




More information about the wine-cvs mailing list