- 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.

svn path=/trunk/; revision=56438
This commit is contained in:
Thomas Faber 2012-04-27 11:04:09 +00:00
parent dfa925989c
commit e5491506f1

View file

@ -2400,20 +2400,12 @@ RtlDosSearchPath_Ustr(IN ULONG Flags,
} }
/* Copy the filename */ /* Copy the filename */
RtlCopyMemory(StaticCandidateString.Buffer, RtlCopyUnicodeString(&StaticCandidateString, FileNameString);
FileNameString->Buffer,
FileNameString->Length);
/* Copy the extension */ /* Copy the extension */
RtlCopyMemory(&StaticCandidateString.Buffer[FileNameString->Length / sizeof(WCHAR)], RtlAppendUnicodeStringToString(&StaticCandidateString,
ExtensionString->Buffer, ExtensionString);
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;
DPRINT("SB: %wZ\n", &StaticCandidateString); DPRINT("SB: %wZ\n", &StaticCandidateString);
/* And check if this file now exists */ /* And check if this file now exists */