From 66ce2774d573d944d289091d3ec68cf308118d97 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 6 Sep 2019 08:10:50 -0400 Subject: [PATCH] DNAMP1/CTweakPlayerGun: Prevent array overrun cases These arrays are both 5 elements in size. Accessing them at index 5 would be out of bounds. --- DataSpec/DNAMP1/Tweaks/CTweakPlayerGun.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/DataSpec/DNAMP1/Tweaks/CTweakPlayerGun.hpp b/DataSpec/DNAMP1/Tweaks/CTweakPlayerGun.hpp index d497e34ee..e9f821187 100644 --- a/DataSpec/DNAMP1/Tweaks/CTweakPlayerGun.hpp +++ b/DataSpec/DNAMP1/Tweaks/CTweakPlayerGun.hpp @@ -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]; }