NTDLL/get_full_path_helper

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Sat Oct 25 11:47:16 CDT 2003


Changelog:
	dlls/ntdll/path.c: get_full_path_helper
	Handle the case \\.\\ as intended
	Explicitly typecase  the arguments for memmove

Otherwise the calculation of the bytes to move went astray for me (gcc
version 3.2) and resulted in Heap corruption.

-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Index: wine/dlls/ntdll/path.c
===================================================================
RCS file: /home/wine/wine/dlls/ntdll/path.c,v
retrieving revision 1.10
diff -u -r1.10 path.c
--- wine/dlls/ntdll/path.c	8 Oct 2003 03:51:31 -0000	1.10
+++ wine/dlls/ntdll/path.c	25 Oct 2003 16:40:04 -0000
@@ -321,6 +321,7 @@
     LPWSTR              ptr;
     UNICODE_STRING*     cd;
 
+    TRACE("name %s size %lu\n",debugstr_w(name),size);
     reqsize = sizeof(WCHAR); /* '\0' at the end */
 
     RtlAcquirePebLock();
@@ -499,7 +500,7 @@
                         /* either collapse \foo\.. into \ or \.. into \ */
                         if (prev < buffer + mark) prev = p - 1;
                         reqsize -= (p + 2 - prev) * sizeof(WCHAR);
-                        memmove(prev, p + 2, buffer + reqsize - prev + sizeof(WCHAR));
+                        memmove(prev, p + 2, (ULONG)buffer + reqsize - (ULONG)prev + sizeof(WCHAR));
                         p = prev;
                     }
                     break;
@@ -511,7 +512,7 @@
                 break;
             case '\\':
                 reqsize -= 2 * sizeof(WCHAR);
-                memmove(ptr, ptr + 2, buffer + reqsize - ptr + sizeof(WCHAR));
+                memmove(p, p + 2, (ULONG)buffer + reqsize - (ULONG)p + sizeof(WCHAR));
                 break;
             }
         }



More information about the wine-patches mailing list