diff options
| author | Archez <Archez@users.noreply.github.com> | 2024-01-12 19:00:24 -0500 |
|---|---|---|
| committer | Garrett Cox <garrettjcox@gmail.com> | 2024-05-22 09:04:57 -0500 |
| commit | 6e0cef8fa046bd65f536cdc5726dc7fdebf6881a (patch) | |
| tree | 8e21434092e6f2eeb893fbc62ea9b08ec10d33d8 /mm/src/code | |
| parent | 248539479d7249dae7ca002373e3d4877a9fb0f5 (diff) | |
properly array bounds check the font table (#32)
Diffstat (limited to 'mm/src/code')
| -rw-r--r-- | mm/src/code/z_kanfont.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/mm/src/code/z_kanfont.c b/mm/src/code/z_kanfont.c index 1182b7a16..a186c84b5 100644 --- a/mm/src/code/z_kanfont.c +++ b/mm/src/code/z_kanfont.c @@ -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], |
