foxygit / doom Log in
commit 8f69372820d74a8859fca445c1084ae1d627276f
Author:     Johan Mattsson <39247600+mjunix@users.noreply.github.com>
AuthorDate: Sat Apr 1 10:55:12 2023 +0200
Commit:     GitHub <noreply@github.com>
CommitDate: Sat Apr 1 10:55:12 2023 +0200

    Fix potential index out of bounds
---
 src/doom/p_inter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/doom/p_inter.c b/src/doom/p_inter.c
index b7c04b90..c0f1f090 100644
--- a/src/doom/p_inter.c
+++ b/src/doom/p_inter.c
@@ -73,7 +73,7 @@ P_GiveAmmo
     if (ammo == am_noammo)
 	return false;

-    if (ammo > NUMAMMO)
+    if (ammo >= NUMAMMO)
 	I_Error ("P_GiveAmmo: bad type %i", ammo);

     if ( player->ammo[ammo] == player->maxammo[ammo]  )