some bug fixes to RtlGetFullPathName_U

Eric Pouech pouech-eric at wanadoo.fr
Fri Oct 3 15:20:34 CDT 2003


A+
-- 
Eric Pouech
-------------- next part --------------
Name:          ntdll
ChangeLog:     fixed a couple of bugs in RtlGetFullPathName_U
License:       X11
GenDate:       2003/10/03 20:19:01 UTC
ModifiedFiles: dlls/ntdll/path.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/dlls/ntdll/path.c,v
retrieving revision 1.7
diff -u -u -r1.7 path.c
--- dlls/ntdll/path.c	2 Oct 2003 04:43:45 -0000	1.7
+++ dlls/ntdll/path.c	3 Oct 2003 20:13:16 -0000
@@ -397,7 +428,11 @@
 
     case RELATIVE_PATH:         /* foo     */
         reqsize += cd->Length;
-        if (reqsize <= size) strcpyW(buffer, cd->Buffer);
+        if (reqsize <= size)
+        {
+            memcpy(buffer, cd->Buffer, cd->Length);
+            buffer[cd->Length / sizeof(WCHAR)] = 0;
+        }
         if (cd->Buffer[1] != ':')
         {
             ptr = strchrW(cd->Buffer + 2, '\\');
@@ -501,7 +536,7 @@
                 break;
             case '\\':
                 reqsize -= 2 * sizeof(WCHAR);
-                memmove(ptr + 2, ptr, buffer + reqsize - ptr + sizeof(WCHAR));
+                memmove(ptr, ptr + 2, buffer + reqsize - ptr + sizeof(WCHAR));
                 break;
             }
         }
@@ -518,7 +553,7 @@
  *
  * Returns the number of bytes written to buffer (not including the
  * terminating NULL) if the function succeeds, or the required number of bytes
- * (including the terminating NULL) if the buffer is to small.
+ * (including the terminating NULL) if the buffer is too small.
  *
  * file_part will point to the filename part inside buffer (except if we use
  * DOS device name, in which case file_in_buf is NULL)


More information about the wine-patches mailing list