Merge pull request #54 from lioncash/overrun

DNAMP1/CTweakPlayerGun: Prevent array overrun cases
This commit is contained in:
Phillip Stephens 2019-09-06 23:20:02 -07:00 committed by GitHub
commit 3a5cb71c74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -89,14 +89,16 @@ struct CTweakPlayerGun final : ITweakPlayerGun {
}
const SWeaponInfo& GetBeamInfo(atInt32 beam) const override {
if (beam < 0 || beam > 5)
if (beam < 0 || beam >= 5) {
return xa8_beams[0];
}
return xa8_beams[beam];
}
const SComboShotParam& GetComboShotInfo(atInt32 beam) const override {
if (beam < 0 || beam > 5)
if (beam < 0 || beam >= 5) {
return x1f0_combos[0];
}
return x1f0_combos[beam];
}