Skip to content
Permalink
Browse files

cgame: fix potential out-of-bounds read in ammo prediction code (cove…

…rity)
  • Loading branch information...
Aranud committed Mar 13, 2019
1 parent cb6dfff commit eba32c9d1361ae1bcb3ed254556c3e61104faa3d
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/cgame/cg_predict.c
@@ -860,11 +860,12 @@ int CG_PredictionOk(playerState_t *ps1, playerState_t *ps2)
}
}

// TODO: use WP_NUM_WEAPONS instead ? we don't need to reach the max weapons, no ?
for (i = 0; i < MAX_WEAPONS; i++)
{
if (ps2->ammo[i] != ps1->ammo[i] || ps2->ammoclip[i] != ps1->ammoclip[i])
{
if (!(GetWeaponTableData(i)->type & WEAPON_TYPE_MELEE)) // FIXME: predict knife?
if (i < WP_NUM_WEAPONS && !(GetWeaponTableData(i)->type & WEAPON_TYPE_MELEE)) // FIXME: predict knife?
{
return 22;
}

0 comments on commit eba32c9

Please sign in to comment.
You can’t perform that action at this time.