2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2024-11-22 01:45:19 +01:00

engine: fix some possible off by one errors

This commit is contained in:
Alibek Omarov 2024-11-17 13:04:20 +03:00
parent 8f7f311f60
commit 229f1560b0
4 changed files with 4 additions and 4 deletions

View File

@ -2422,7 +2422,7 @@ static void GAME_EXPORT pfnKillEvents( int entnum, const char *eventname )
if( eventIndex >= MAX_EVENTS )
return;
if( entnum < 0 || entnum > clgame.maxEntities )
if( entnum < 0 || entnum >= clgame.maxEntities )
return;
es = &cl.events;

View File

@ -684,7 +684,7 @@ static void Mod_CreatePolygonsForHull( int hullnum )
char name[8];
int i;
if( hullnum < 0 || hullnum > 3 )
if( hullnum < 0 || hullnum >= MAX_MAP_HULLS )
return;
if( !world.num_hull_models )

View File

@ -93,7 +93,7 @@ VID_GetModeString
const char *VID_GetModeString( int vid_mode )
{
vidmode_t *vidmode;
if( vid_mode < 0 || vid_mode > R_MaxVideoModes() )
if( vid_mode < 0 || vid_mode >= R_MaxVideoModes() )
return NULL;
if( !( vidmode = R_GetVideoMode( vid_mode ) ) )

View File

@ -2791,7 +2791,7 @@ static void Mod_LoadTexInfo( model_t *mod, dbspmodel_t *bmod )
out->vecs[j][k] = in->vecs[j][k];
miptex = in->miptex;
if( miptex < 0 || miptex > mod->numtextures )
if( miptex < 0 || miptex >= mod->numtextures )
miptex = 0; // this is possible?
out->texture = mod->textures[miptex];
out->flags = in->flags;