From 16848de7146514bb05e631c0ebed4f35ba2991ca Mon Sep 17 00:00:00 2001 From: divverent Date: Mon, 14 Jul 2008 13:17:47 +0000 Subject: [PATCH] fix out of range indices found by [-z-] git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8402 d7cf8633-e32d-0410-b094-e92efae38249 --- model_brush.c | 2 +- netconn.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/model_brush.c b/model_brush.c index f61696a0..d65971a4 100644 --- a/model_brush.c +++ b/model_brush.c @@ -1411,7 +1411,7 @@ static void Mod_Q1BSP_LoadTextures(lump_t *l) // copy name, but only up to 16 characters // (the output buffer can hold more than this, but the input buffer is // only 16) - for (j = 0;dmiptex->name[j] && j < 16;j++) + for (j = 0;j < 16 && dmiptex->name[j];j++) name[j] = dmiptex->name[j]; name[j] = 0; diff --git a/netconn.c b/netconn.c index 7ea599c7..d114d7c2 100755 --- a/netconn.c +++ b/netconn.c @@ -327,11 +327,11 @@ static void ServerList_ViewList_Insert( serverlist_entry_t *entry ) // FIXME: change this to be more readable (...) // now check whether it passes through the masks - for( start = 0 ; serverlist_andmasks[start].active && start < SERVERLIST_ANDMASKCOUNT ; start++ ) + for( start = 0 ; start < SERVERLIST_ANDMASKCOUNT && serverlist_andmasks[start].active; start++ ) if( !_ServerList_Entry_Mask( &serverlist_andmasks[start], &entry->info ) ) return; - for( start = 0 ; serverlist_ormasks[start].active && start < SERVERLIST_ORMASKCOUNT ; start++ ) + for( start = 0 ; start < SERVERLIST_ORMASKCOUNT && serverlist_ormasks[start].active ; start++ ) if( _ServerList_Entry_Mask( &serverlist_ormasks[start], &entry->info ) ) break; if( start == SERVERLIST_ORMASKCOUNT || (start > 0 && !serverlist_ormasks[start].active) ) -- 2.39.2