From 50c8fae6ecbc208c29c291829d367d6621b05dfa Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Fri, 26 Apr 2013 23:38:20 +0200 Subject: TINSEL: Reorder loop condition to fix out-of-bounds access This should fix CID 1003943 and CID 1003944. --- engines/tinsel/dialogs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engines/tinsel/dialogs.cpp b/engines/tinsel/dialogs.cpp index d0c99f7830..e6229ff3a0 100644 --- a/engines/tinsel/dialogs.cpp +++ b/engines/tinsel/dialogs.cpp @@ -3655,10 +3655,10 @@ extern void HideConversation(bool bHide) { if (g_InventoryState == ACTIVE_INV && g_ino == INV_CONV) { if (bHide) { // Move all the window and icons off-screen - for (i = 0; g_objArray[i] && i < MAX_WCOMP; i++) { + for (i = 0; i < MAX_WCOMP && g_objArray[i]; i++) { MultiAdjustXY(g_objArray[i], 2 * SCREEN_WIDTH, 0); } - for (i = 0; g_iconArray[i] && i < MAX_ICONS; i++) { + for (i = 0; i < MAX_ICONS && g_iconArray[i]; i++) { MultiAdjustXY(g_iconArray[i], 2 * SCREEN_WIDTH, 0); } -- cgit v1.2.3