- Fix an out-of-bounds read in RtlpDidUnicodeToOemWorked.
See issue #4888 for more details.

svn path=/trunk/; revision=43438
This commit is contained in:
Aleksey Bragin 2009-10-13 18:01:55 +00:00
parent 89bda0c12e
commit 352dfbf644

View file

@ -417,12 +417,12 @@ RtlpDidUnicodeToOemWork(IN PCUNICODE_STRING UnicodeString,
ULONG i = 0;
/* Go through all characters of a string */
while ((OemString->Buffer[i] != 0) &&
(i < OemString->Length))
while (i < OemString->Length)
{
/* Check if it got translated into '?', but source char
wasn't '?' equivalent */
if ((OemString->Buffer[i] == NlsOemDefaultChar) &&
if ((OemString->Buffer[i] != 0) &&
(OemString->Buffer[i] == NlsOemDefaultChar) &&
(UnicodeString->Buffer[i] != NlsUnicodeDefaultChar))
{
/* Yes, it means unmappable characters were found */