Match LetterWriter sendToPC #38

Merged
coah80 merged 1 commits from codex/letterwriter-sendtopc-20260921 into main 2026-09-21 22:27:35 +00:00

View File

@@ -557,32 +557,33 @@ namespace ipl {
int LetterWriter::sendToPC(NWC24UserId userId, const wchar_t* wcString) {
NWC24MsgObj msgObj;
macroscopeapp[bot] commented 2026-09-21 22:28:29 +00:00 (Migrated from github.com)
Review

🟠 High letterWriter/iplLetterWriter.cpp:559

The successful address setup path reads past lbl_816503CE and can crash: report + 0xEB resolves to lbl_816503CE + 0x139, beyond its declared 0x12A bytes. Because report already starts at offset 0x4E, the other calls also select incorrect diagnostic strings; use the original base pointer for these offsets or adjust every offset relative to report.

🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @src/scene/letterWriter/iplLetterWriter.cpp around line 559:

The successful address setup path reads past `lbl_816503CE` and can crash: `report + 0xEB` resolves to `lbl_816503CE + 0x139`, beyond its declared `0x12A` bytes. Because `report` already starts at offset `0x4E`, the other calls also select incorrect diagnostic strings; use the original base pointer for these offsets or adjust every offset relative to `report`.
🟠 **High** `letterWriter/iplLetterWriter.cpp:559` The successful address setup path reads past `lbl_816503CE` and can crash: `report + 0xEB` resolves to `lbl_816503CE + 0x139`, beyond its declared `0x12A` bytes. Because `report` already starts at offset `0x4E`, the other calls also select incorrect diagnostic strings; use the original base pointer for these offsets or adjust every offset relative to `report`. <details> <summary>🚀 Reply "<strong>fix it for me</strong>" or copy this <strong>AI Prompt</strong> for your agent:</summary> ```text In file @src/scene/letterWriter/iplLetterWriter.cpp around line 559: The successful address setup path reads past `lbl_816503CE` and can crash: `report + 0xEB` resolves to `lbl_816503CE + 0x139`, beyond its declared `0x12A` bytes. Because `report` already starts at offset `0x4E`, the other calls also select incorrect diagnostic strings; use the original base pointer for these offsets or adjust every offset relative to `report`. ``` </details> <!-- macroscope-meta: {"kind":"code_review","variant":"195358a06841b2d4d03feb0d212d1ca7"} -->
const char* report = lbl_816503CE + 0x4E;
// Create message object
if (!System::getNwc24Manager()->initMsgObj(&msgObj, NWC24_MSGTYPE_PUBLIC)) {
OSReport(lbl_816503CE + 0xA);
OSReport(report + 0xA);
return SEND_ERR_NWC24;
}
// Set message to ID (in this case, my user ID)
if (!System::getNwc24Manager()->setMsgToAddr(&msgObj, mFriendInfo.addr.mailAddr, strlen(mFriendInfo.addr.mailAddr))) {
OSReport(lbl_816503CE + 0xD4);
OSReport(report + 0xD4);
return SEND_ERR_NWC24;
}
OSReport(lbl_816503CE + 0xEB, mFriendInfo.addr.mailAddr);
OSReport(report + 0xEB, mFriendInfo.addr.mailAddr);
// Set letter contents
const wchar_t* subject = System::getMessage(MESG_LETTERWRITER_EMAIL_SUBJECT);
if (!System::getNwc24Manager()->setMsgSubjectAndTextPublic(&msgObj, (u16*)subject, wcslen(subject), (u16*)wcString, wcslen(wcString),
mpTextSubjectWork, mTextSubjectWorkSize)) {
OSReport(lbl_816503CE + 0x107);
OSReport(report + 0x107);
return SEND_ERR_NWC24;
}
// Send!
if (!System::getNwc24Manager()->commitMsg(&msgObj)) {
OSReport(lbl_816503CE + 0xC0);
OSReport(report + 0xC0);
return SEND_ERR_NWC24;
}