Browse Source

engine: server: fix possible null pointer dereference

master
Alibek Omarov 10 months ago
parent
commit
862b9e68be
  1. 2
      engine/server/sv_init.c
  2. 4
      engine/server/sv_phys.c

2
engine/server/sv_init.c

@ -545,7 +545,7 @@ void SV_FreeOldEntities( void ) @@ -545,7 +545,7 @@ void SV_FreeOldEntities( void )
}
// decrement svgame.numEntities if the highest number entities died
for( ; EDICT_NUM( svgame.numEntities - 1 )->free; svgame.numEntities-- );
for( ; ( ent = EDICT_NUM( svgame.numEntities - 1 )) && ent->free; svgame.numEntities-- );
}
/*

4
engine/server/sv_phys.c

@ -1842,8 +1842,10 @@ void SV_Physics( void ) @@ -1842,8 +1842,10 @@ void SV_Physics( void )
// increase framecount
sv.framecount++;
#if 0 // figure out why this causes memory corruption
// decrement svgame.numEntities if the highest number entities died
for( ; EDICT_NUM( svgame.numEntities - 1 )->free; svgame.numEntities-- );
for( ; ( ent = EDICT_NUM( svgame.numEntities - 1 )) && ent->free; svgame.numEntities-- );
#endif
}
/*

Loading…
Cancel
Save