From 22065819521adbf671168fc6acb4526ec60130ae Mon Sep 17 00:00:00 2001 From: terminx Date: Sun, 7 Oct 2018 05:22:13 +0000 Subject: [PATCH] Prevent OOB array access when EVENT_INVENTORYLEFT or EVENT_INVENTORYRIGHT returns a bad value git-svn-id: https://svn.eduke32.com/eduke32@7026 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/duke3d/src/sector.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/duke3d/src/sector.cpp b/source/duke3d/src/sector.cpp index 3b7086c62..4f80d5c32 100644 --- a/source/duke3d/src/sector.cpp +++ b/source/duke3d/src/sector.cpp @@ -2627,10 +2627,10 @@ CHECKINV1: if (inventoryIcon || pPlayer->inv_amount[GET_FIRSTAID]) { - static const int32_t i[8] = { QUOTE_MEDKIT, QUOTE_STEROIDS, QUOTE_HOLODUKE, + static const int32_t invQuotes[8] = { QUOTE_MEDKIT, QUOTE_STEROIDS, QUOTE_HOLODUKE, QUOTE_JETPACK, QUOTE_NVG, QUOTE_SCUBA, QUOTE_BOOTS, 0 }; - if (inventoryIcon>=1 && inventoryIcon<=9) - P_DoQuote(i[inventoryIcon-1], pPlayer); + if (inventoryIcon-1 < ARRAY_SSIZE(invQuotes)) + P_DoQuote(invQuotes[inventoryIcon-1], pPlayer); } } }