Skip to content

Commit

Permalink
Fix a potential buffer overflow in CPhysicsManager::GenerateIndexedAr…
Browse files Browse the repository at this point in the history
…rayForBrush which may cause random crash.
  • Loading branch information
hzqst committed May 14, 2024
1 parent 79618af commit cd61bb2
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions Plugins/BulletPhysics/physics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,16 +366,7 @@ void CPhysicsManager::GenerateIndexedArrayForBrush(model_t *mod, vertexarray_t *
{
for (int i = 0; i < mod->nummodelsurfaces; i++)
{
msurface_t* surf;

if (g_iEngineType == ENGINE_GOLDSRC_HL25)
{
surf = (((msurface_hl25_t*)mod->surfaces) + mod->firstmodelsurface + i);
}
else
{
surf = mod->surfaces + mod->firstmodelsurface + i;
}
auto surf = GetWorldSurfaceByIndex(mod->firstmodelsurface + i);

GenerateIndexedArrayForSurface(surf, vertexarray, indexarray);
}
Expand Down

0 comments on commit cd61bb2

Please sign in to comment.