mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 13:35:12 +00:00
fix write out of bounds in smlua text utils (#13)
This commit is contained in:
parent
974577f678
commit
7468ff001b
1 changed files with 2 additions and 2 deletions
|
@ -35,7 +35,7 @@ void smlua_text_utils_init(void) {
|
||||||
|
|
||||||
// Course/Star names
|
// Course/Star names
|
||||||
for (s16 courseNum = 0; courseNum < COURSE_END; courseNum++) {
|
for (s16 courseNum = 0; courseNum < COURSE_END; courseNum++) {
|
||||||
gReplacedActNameTable[courseNum] = malloc(sizeof(struct CourseName));
|
gReplacedActNameTable[courseNum] = calloc(1, sizeof(struct CourseName));
|
||||||
struct CourseName* courseActNames = gReplacedActNameTable[courseNum];
|
struct CourseName* courseActNames = gReplacedActNameTable[courseNum];
|
||||||
convert_string_sm64_to_ascii(courseBuffer, segmented_to_virtual(courseNameTbl[courseNum]));
|
convert_string_sm64_to_ascii(courseBuffer, segmented_to_virtual(courseNameTbl[courseNum]));
|
||||||
snprintf(courseActNames->name, 50, "%s", courseBuffer);
|
snprintf(courseActNames->name, 50, "%s", courseBuffer);
|
||||||
|
@ -52,7 +52,7 @@ void smlua_text_utils_init(void) {
|
||||||
snprintf(courseActNames->actName[actNum].orig, 50, "%s", actBuffer);
|
snprintf(courseActNames->actName[actNum].orig, 50, "%s", actBuffer);
|
||||||
courseActNames->actName[actNum].modIndex = -1;
|
courseActNames->actName[actNum].modIndex = -1;
|
||||||
}
|
}
|
||||||
courseActNames->actName[MAX_ACTS_AND_100_COINS].modIndex = -1;
|
courseActNames->actName[MAX_ACTS_AND_100_COINS - 1].modIndex = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue