summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDirk-Jan C. Binnema <djcb@djcbsoftware.nl>2025-10-25 16:55:02 +0300
committerDirk-Jan C. Binnema <djcb@djcbsoftware.nl>2025-10-25 16:55:43 +0300
commit7ac3b383237abd1eef6981e4d8cedaec4b7c8ad7 (patch)
tree40ffee295f74c00c2f1ec1236142ce65b9f78655 /lib
parent825fed4be8c5e68b25a7b04cfccff46cdd86e4f2 (diff)
message: ensure message text is valid utf8
Seems this is not guaranteed, so convert if needed.
Diffstat (limited to 'lib')
-rw-r--r--lib/message/mu-message.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/message/mu-message.cc b/lib/message/mu-message.cc
index 2d7c17f..4659eb8 100644
--- a/lib/message/mu-message.cc
+++ b/lib/message/mu-message.cc
@@ -374,10 +374,15 @@ get_mailing_list(const MimeMessage& mime_msg)
static void
append_text(Option<std::string>& str, Option<std::string>&& app)
{
+ /*
+ * it is not guaranteed that what we get here is valid utf8,
+ * so we enforce it with utf8_clean
+ */
+
if (!str && app)
- str = std::move(*app);
+ str = utf8_clean(std::move(*app));
else if (str && app)
- str.value() += app.value();
+ str.value() += utf8_clean(app.value());
}
static void