Fix array overflow in chrnum lookup

This commit is contained in:
Ryan Dwyer
2022-10-30 13:14:16 +10:00
parent 1215434097
commit 3aa6674330
+1 -1
View File
@@ -5369,7 +5369,7 @@ void chrsCheckForNoise(f32 noiseradius)
struct chrdata *chrFindByLiteralId(s32 chrnum)
{
if (g_ChrIndexesByChrnum[chrnum] >= 0) {
if (chrnum >= 0 && chrnum < ARRAYCOUNT(g_ChrIndexesByChrnum) && g_ChrIndexesByChrnum[chrnum] >= 0) {
return &g_ChrSlots[g_ChrIndexesByChrnum[chrnum]];
}