mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-05 03:24:56 +08:00
ref: fix out of bound access when the entity is marked as player but has invalid number
It's possible when client.dll passes a self allocated entity and wants to draw it as player but doesn't initialize or set the entity number correctly.
This commit is contained in:
@@ -2353,6 +2353,9 @@ static model_t *R_StudioSetupPlayerModel( int index )
|
||||
player_info_t *info = gEngfuncs.pfnPlayerInfo( index );
|
||||
player_model_t *state;
|
||||
|
||||
if( index < 0 || index >= gp_cl->maxclients )
|
||||
return NULL;
|
||||
|
||||
state = &g_studio.player_models[index];
|
||||
|
||||
// g-cont: force for "dev-mode", non-local games and menu preview
|
||||
@@ -2396,7 +2399,7 @@ int R_GetEntityRenderMode( cl_entity_t *ent )
|
||||
int i, opaque, trans;
|
||||
mstudiotexture_t *ptexture;
|
||||
cl_entity_t *oldent;
|
||||
model_t *model;
|
||||
model_t *model = NULL;
|
||||
studiohdr_t *phdr;
|
||||
|
||||
oldent = RI.currententity;
|
||||
@@ -2404,7 +2407,8 @@ int R_GetEntityRenderMode( cl_entity_t *ent )
|
||||
|
||||
if( ent->player ) // check it for real playermodel
|
||||
model = R_StudioSetupPlayerModel( ent->curstate.number - 1 );
|
||||
else
|
||||
|
||||
if( !model )
|
||||
model = ent->model;
|
||||
|
||||
RI.currententity = oldent;
|
||||
|
||||
Reference in New Issue
Block a user