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
This commit is contained in:
terminx 2018-10-07 05:22:13 +00:00
parent eeba7847eb
commit 2206581952

View file

@ -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);
}
}
}