summaryrefslogtreecommitdiff
path: root/src/d/d_msg_object.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/d/d_msg_object.cpp')
-rw-r--r--src/d/d_msg_object.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/d/d_msg_object.cpp b/src/d/d_msg_object.cpp
index 0cb515113c..29b8cbdd41 100644
--- a/src/d/d_msg_object.cpp
+++ b/src/d/d_msg_object.cpp
@@ -1602,7 +1602,16 @@ u8 dMsgObject_c::isSend() {
}
void dMsgObject_c::readMessageGroupLocal(mDoDvdThd_mountXArchive_c** p_arcMount) {
+#if AVOID_UB
+ // largest possible value msgGroup appears to be 99, but just in case
+ // we leave enough space to fit INT_MAX
+ static char arcName[32];
+#else
+ // We write at least 23 bytes into this which causes an overflow,
+ // but in practice arcName is followed by two bytes of padding
+ // at the end of .bss which mitigates the problem.
static char arcName[22];
+#endif
int msgGroup = dStage_stagInfo_GetMsgGroup(dComIfGp_getStage()->getStagInfo());
#if REGION_PAL
@@ -2133,7 +2142,7 @@ u16 dMsgObject_c::getSmellTypeMessageIDLocal() {
if (smell < dItemNo_SMELL_MEDICINE_e + 1 && smell >= dItemNo_SMELL_YELIA_POUCH_e) {
msgId = smell + 0x165;
} else {
- if (dComIfGs_getCollectSmell() != -1) {
+ if (dComIfGs_getCollectSmell() != 0xFF) {
OS_REPORT("smell type ====> %d\n", dComIfGs_getCollectSmell());
JUT_WARN(4858, "smell type no entry!");
}