mirror of
https://github.com/1dot13/source.git
synced 2026-08-26 14:30:26 +02:00
Guard against possible illegal array access (by Seven) (#121)
ClosestPanicTrigger() can return -1 but its use in indexing gTacticalStatus.bPanicTriggerIsAlarm was not checked in all the places in the code
This commit is contained in:
@@ -3206,14 +3206,14 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
|
||||
case 762:
|
||||
{
|
||||
// CODE: Set off Trigger
|
||||
INT8 bPanicTrigger;
|
||||
|
||||
bPanicTrigger = ClosestPanicTrigger( pSoldier );
|
||||
SetOffPanicBombs( pSoldier->ubID, bPanicTrigger );
|
||||
INT8 bPanicTrigger = ClosestPanicTrigger( pSoldier );
|
||||
if (bPanicTrigger != -1)
|
||||
{
|
||||
SetOffPanicBombs( pSoldier->ubID, bPanicTrigger );
|
||||
}
|
||||
// any AI guy has been specially given keys for this, now take them
|
||||
// away
|
||||
pSoldier->flags.bHasKeys = pSoldier->flags.bHasKeys >> 1;
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user