gdi32: Prevent possible buffer overrun.

This commit is contained in:
Nikolay Sivov 2009-10-19 23:40:28 +04:00 committed by Alexandre Julliard
parent 975a93de68
commit dd0a7078e0
1 changed files with 3 additions and 3 deletions

View File

@ -2596,13 +2596,13 @@ BOOL WINAPI TranslateCharsetInfo(
int index = 0;
switch (flags) {
case TCI_SRCFONTSIG:
while (!(*lpSrc>>index & 0x0001) && index<MAXTCIINDEX) index++;
while (index < MAXTCIINDEX && !(*lpSrc>>index & 0x0001)) index++;
break;
case TCI_SRCCODEPAGE:
while (PtrToUlong(lpSrc) != FONT_tci[index].ciACP && index < MAXTCIINDEX) index++;
while (index < MAXTCIINDEX && PtrToUlong(lpSrc) != FONT_tci[index].ciACP) index++;
break;
case TCI_SRCCHARSET:
while (PtrToUlong(lpSrc) != FONT_tci[index].ciCharset && index < MAXTCIINDEX) index++;
while (index < MAXTCIINDEX && PtrToUlong(lpSrc) != FONT_tci[index].ciCharset) index++;
break;
default:
return FALSE;