Skip to content
Snippets Groups Projects
Commit 7ea01b60 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Refactor/order the handling of reply-to-message header data

Fix CID 551210

There should not be any change in behavior here other than eliminating a
potential null pointer dereference.
parent 6c98e287
No related branches found
No related tags found
No related merge requests found
Pipeline #8969 passed
...@@ -100,22 +100,21 @@ bool sbbs_t::postmsg(int subnum, int wm_mode, smb_t* resmb, smbmsg_t* remsg) ...@@ -100,22 +100,21 @@ bool sbbs_t::postmsg(int subnum, int wm_mode, smb_t* resmb, smbmsg_t* remsg)
SAFECOPY(from, text[Anonymous]); SAFECOPY(from, text[Anonymous]);
else else
SAFECOPY_UTF8(from, msghdr_field(remsg, remsg->from, NULL, term->charset() == CHARSET_UTF8)); SAFECOPY_UTF8(from, msghdr_field(remsg, remsg->from, NULL, term->charset() == CHARSET_UTF8));
SAFECOPY_UTF8(touser, from);
// If user posted this message, reply to the original recipient again // If user posted this message, reply to the original recipient again
if (remsg->to != NULL if (remsg->to != NULL) {
&& ((remsg->from_ext != NULL && atoi(remsg->from_ext) == useron.number) if ((remsg->from_ext != NULL && atoi(remsg->from_ext) == useron.number)
|| stricmp(useron.alias, remsg->from) == 0 || stricmp(useron.name, remsg->from) == 0)) || stricmp(useron.alias, remsg->from) == 0 || stricmp(useron.name, remsg->from) == 0)
SAFECOPY_UTF8(touser, msghdr_field(remsg, remsg->to, NULL, term->charset() == CHARSET_UTF8)); SAFECOPY_UTF8(touser, msghdr_field(remsg, remsg->to, NULL, term->charset() == CHARSET_UTF8));
else
SAFECOPY_UTF8(touser, from);
if (remsg->to != NULL)
strListPush(&names, remsg->to); strListPush(&names, remsg->to);
msgattr = (ushort)(remsg->hdr.attr & MSG_PRIVATE);
SAFECOPY(top, format_text(RegardingByToOn, remsg SAFECOPY(top, format_text(RegardingByToOn, remsg
, title , title
, from , from
, msghdr_field(remsg, remsg->to, NULL, term->charset() == CHARSET_UTF8) , msghdr_field(remsg, remsg->to, NULL, term->charset() == CHARSET_UTF8)
, timestr(smb_time(remsg->hdr.when_written)) , timestr(smb_time(remsg->hdr.when_written))
, smb_zonestr(remsg->hdr.when_written.zone, NULL))); , smb_zonestr(remsg->hdr.when_written.zone, NULL)));
}
msgattr = (ushort)(remsg->hdr.attr & MSG_PRIVATE);
if (remsg->tags != NULL) if (remsg->tags != NULL)
SAFECOPY(tags, remsg->tags); SAFECOPY(tags, remsg->tags);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment