Skip to content

Commit 9f6894a

Browse files
committed
exmdb: check return value of set_content_type calls
CID 1559995: (#1 of 1): Unchecked return value (CHECKED_RETURN) CID 1559999: (#1 of 1): Unchecked return value (CHECKED_RETURN) CID 1560002: (#1 of 1): Unchecked return value (CHECKED_RETURN) 14. check_return: Calling set_content_type without checking return value (as is done elsewhere 23 out of 27 times).
1 parent 537adb1 commit 9f6894a

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

exch/exmdb/message.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2726,7 +2726,8 @@ static ec_error_t message_forward_message(const rulexec_in &rp,
27262726
auto pmime = imail1.add_head();
27272727
if (pmime == nullptr)
27282728
return ecServerOOM;
2729-
pmime->set_content_type("message/rfc822");
2729+
if (!pmime->set_content_type("message/rfc822"))
2730+
mlog(LV_WARN, "W-1767: set_content_type not successful, investigate");
27302731
/*
27312732
* OXORULE v21 §2.2.5.1.1 specifies FWD_AS_ATTACHMENT is
27322733
* exclusive, so FWD_PRESERVE_SENDER is not evaluated to build

lib/mapi/oxcmail.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4000,7 +4000,8 @@ static bool smime_signed_writeout(MAIL &origmail, MIME &origmime,
40004000
auto s = fmt::format("[Message is not a valid OXOSMIME message. "
40014001
"The attachment object is not of type multipart/signed.]");
40024002
origmime.write_content(s.c_str(), s.size(), mime_encoding::none);
4003-
origmime.set_content_type("text/plain");
4003+
if (!origmime.set_content_type("text/plain"))
4004+
/* ignore */;
40044005
return TRUE;
40054006
}
40064007
if (buf[16] != '\0' && buf[16] != ';')

mda/exmdb_local/auto_response.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ void auto_response_reply(const char *user_home,
187187
put_context(pcontext);
188188
return;
189189
}
190-
pmime->set_content_type(content_type);
190+
if (!pmime->set_content_type(content_type))
191+
mlog(LV_WARN, "W-1777: set_content_type unsuccessful");
191192
if (*charset != '\0')
192193
pmime->set_content_param("charset", charset);
193194
pmime->set_field("From", from);

0 commit comments

Comments
 (0)