Alexandre Julliard : ntdll: Always add path separator when looking for a relative path name.

Alexandre Julliard julliard at winehq.org
Mon Apr 20 15:01:49 CDT 2020


Module: wine
Branch: oldstable
Commit: 3c91375533b14eac1fd252e386bb835c08e0761e
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=3c91375533b14eac1fd252e386bb835c08e0761e

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Oct 22 09:57:00 2019 +0200

ntdll: Always add path separator when looking for a relative path name.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47979
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit e4595a0ce8fd26d10d2bd47a310d1c1cf7bd953f)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 dlls/ntdll/directory.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c
index 1b927cbb7f..8b503e999d 100644
--- a/dlls/ntdll/directory.c
+++ b/dlls/ntdll/directory.c
@@ -2632,19 +2632,20 @@ static NTSTATUS lookup_unix_name( const WCHAR *name, int name_len, char **buffer
 
     /* try a shortcut first */
 
-    ret = ntdll_wcstoumbs( 0, name, name_len, unix_name + pos, unix_len - pos - 1,
-                           NULL, &used_default );
-
     while (name_len && IS_SEPARATOR(*name))
     {
         name++;
         name_len--;
     }
 
+    unix_name[pos] = '/';
+    ret = ntdll_wcstoumbs( 0, name, name_len, unix_name + pos + 1, unix_len - pos - 2,
+                           NULL, &used_default );
+
     if (ret >= 0 && !used_default)  /* if we used the default char the name didn't convert properly */
     {
         char *p;
-        unix_name[pos + ret] = 0;
+        unix_name[pos + 1 + ret] = 0;
         for (p = unix_name + pos ; *p; p++) if (*p == '\\') *p = '/';
         if (!name_len || !redirect || (!strstr( unix_name, "/windows/") && strncmp( unix_name, "windows/", 8 )))
         {




More information about the wine-cvs mailing list