properly array bounds check the font table (#32)

This commit is contained in:
Archez 2024-01-12 19:00:24 -05:00 committed by Garrett Cox
parent 248539479d
commit 6e0cef8fa0

View File

@ -181,8 +181,9 @@ void Font_LoadCharNES(PlayState* play, u8 codePointIndex, s32 offset) {
int fontIdx = codePointIndex - 0x20;
if (codePointIndex < 0x8B)
if (fontIdx >= 0 && fontIdx < ARRAY_COUNT(fontTbl)) {
memcpy(&font->charBuf[font->unk_11D88][offset], fontTbl[fontIdx], strlen(fontTbl[fontIdx]) + 1);
}
// DmaMgr_SendRequest0(&font->charBuf[font->unk_11D88][offset],
//&((u8*)SEGMENT_ROM_START(nes_font_static))[(codePointIndex - ' ') * FONT_CHAR_TEX_SIZE],