]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fix out of range indices found by [-z-]
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 14 Jul 2008 13:17:47 +0000 (13:17 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 14 Jul 2008 13:17:47 +0000 (13:17 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8402 d7cf8633-e32d-0410-b094-e92efae38249

model_brush.c
netconn.c

index f61696a0d94bd80f722eb86cec7729214226b39a..d65971a45ad41726497e089027767fe89048b9b5 100644 (file)
@@ -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;
 
index 7ea599c7a540397675587489181a03cc3a6c0970..d114d7c2008a0a28c0cc60e716f5de1d80fe47fc 100755 (executable)
--- 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) )