Author: tfaber
Date: Fri Apr 27 11:04:09 2012
New Revision: 56438

URL: http://svn.reactos.org/svn/reactos?rev=56438&view=rev
Log:
[RTL]
- Do not null terminate buffer before initializing its length in 
RtlDosSearchPath_Ustr. Use unicode string functions made for this purpose 
instead.
See issue #7010 for more details.

Modified:
    trunk/reactos/lib/rtl/path.c

Modified: trunk/reactos/lib/rtl/path.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/path.c?rev=56438&r1=56437&r2=56438&view=diff
==============================================================================
--- trunk/reactos/lib/rtl/path.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/path.c [iso-8859-1] Fri Apr 27 11:04:09 2012
@@ -2400,20 +2400,12 @@
             }
 
             /* Copy the filename */
-            RtlCopyMemory(StaticCandidateString.Buffer,
-                          FileNameString->Buffer,
-                          FileNameString->Length);
+            RtlCopyUnicodeString(&StaticCandidateString, FileNameString);
 
             /* Copy the extension */
-            RtlCopyMemory(&StaticCandidateString.Buffer[FileNameString->Length 
/ sizeof(WCHAR)],
-                          ExtensionString->Buffer,
-                          ExtensionString->Length);
-
-            /* Now NULL-terminate */
-            StaticCandidateString.Buffer[StaticCandidateString.Length / 
sizeof(WCHAR)] = UNICODE_NULL;
-
-            /* Finalize the length of the string to make it valid */
-            StaticCandidateString.Length = FileNameString->Length + 
ExtensionString->Length;
+            RtlAppendUnicodeStringToString(&StaticCandidateString,
+                                           ExtensionString);
+
             DPRINT("SB: %wZ\n", &StaticCandidateString);
 
             /* And check if this file now exists */


Reply via email to