From 352dfbf644203a1698406deaf7ff471ae46ca902 Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Tue, 13 Oct 2009 18:01:55 +0000 Subject: [PATCH] [rtl] - Fix an out-of-bounds read in RtlpDidUnicodeToOemWorked. See issue #4888 for more details. svn path=/trunk/; revision=43438 --- reactos/lib/rtl/unicode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/reactos/lib/rtl/unicode.c b/reactos/lib/rtl/unicode.c index c1f23583723..bafe8c5cc67 100644 --- a/reactos/lib/rtl/unicode.c +++ b/reactos/lib/rtl/unicode.c @@ -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 */ -- 2.17.1