From a724d1b9ad9503a063a9ee04d49006ef8616b5ab Mon Sep 17 00:00:00 2001 From: PJB3005 Date: Mon, 16 Mar 2026 15:44:26 +0100 Subject: [PATCH] Fix sprintf buffer too small in dMsgObject_c::readMessageGroupLocal --- src/d/d_msg_object.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/d/d_msg_object.cpp b/src/d/d_msg_object.cpp index 39c44b1470..37ca9cff28 100644 --- a/src/d/d_msg_object.cpp +++ b/src/d/d_msg_object.cpp @@ -1602,7 +1602,10 @@ u8 dMsgObject_c::isSend() { } void dMsgObject_c::readMessageGroupLocal(mDoDvdThd_mountXArchive_c** p_arcMount) { - static char arcName[22]; +#if TARGET_PC + static char arcName[32]; +#else +#endif int msgGroup = dStage_stagInfo_GetMsgGroup(dComIfGp_getStage()->getStagInfo()); #if REGION_PAL @@ -1625,7 +1628,12 @@ void dMsgObject_c::readMessageGroupLocal(mDoDvdThd_mountXArchive_c** p_arcMount) #elif REGION_JPN sprintf(arcName, "/res/Msgjp/bmgres%d.arc", msgGroup); #else +#if TARGET_PC + // Original game UB + snprintf(arcName, sizeof(arcName), "/res/Msgus/bmgres%d.arc", msgGroup); +#else sprintf(arcName, "/res/Msgus/bmgres%d.arc", msgGroup); +#endif #endif *p_arcMount = mDoDvdThd_mountXArchive_c::create(arcName, 0, JKRArchive::MOUNT_MEM, NULL);