mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-05 18:57:14 -04:00
String safety (#1548)
* Array size UB fixes * Fix ShieldD * Remove (almost) all unsafe strcpy calls Bunch of macros. C arrays are easy enough and just need a different call. For various cases where a char* is passed around bare, I've made a TEXT_SPAN macro that can store a length too for bounds checking. * Move crash handling in safe string operations to separate TU * strcat safe version * sprintf made safe too * Fix compile
This commit is contained in:
committed by
GitHub
parent
af162bbd0a
commit
a6376368ee
@@ -351,13 +351,13 @@ const char* daSetBgObj_c::getArcName(fopAc_ac_c* i_this) {
|
||||
|
||||
u32 r30 = fopAcM_GetParam(i_this);
|
||||
u16 r29 = fopAcM_GetParam(i_this);
|
||||
sprintf(arcName, "@bg%04x", r29);
|
||||
SAFE_SPRINTF(arcName, "@bg%04x", r29);
|
||||
|
||||
if (DEBUG && r30 & 0x80000000) {
|
||||
OS_REPORT("\e[43;30m旧仕様の地形ユニットMoveBGが残っています!!!\n\e[m");
|
||||
u16 r28 = r30 >> 12 & 0x1FF;
|
||||
u16 r27 = r30 & 0xFFF;
|
||||
sprintf(arcName, "@%03x%03x", r28, (u16)r27);
|
||||
SAFE_SPRINTF(arcName, "@%03x%03x", r28, (u16)r27);
|
||||
}
|
||||
return arcName;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user