Commit e06ec5e7 authored by Michael Gratton's avatar Michael Gratton 🤞

Fix crash in Geary.RFC822.init()

Due to an undocumented expectation in GMime.set_user_charsets(), the
array passed in must be null-terminated.

Fixes #225
parent c62a22ab
Pipeline #61177 failed with stages
in 15 minutes and 26 seconds
......@@ -19,11 +19,6 @@ public enum TextFormat {
*/
public const string UTF8_CHARSET = "UTF-8";
// This has the effect of ensuring all non US-ASCII and non-ISO-8859-1
// headers are always encoded as UTF-8. This should be fine because
// message bodies are also always sent as UTF-8.
private const string[] USER_CHARSETS = { UTF8_CHARSET };
private int init_count = 0;
internal Regex? invalid_filename_character_re = null;
......@@ -33,6 +28,16 @@ public void init() {
return;
GMime.init(GMime.ENABLE_RFC2047_WORKAROUNDS);
// This has the effect of ensuring all non US-ASCII and non-ISO-8859-1
// headers are always encoded as UTF-8. This should be fine because
// message bodies are also always sent as UTF-8.
const string?[] USER_CHARSETS = {
UTF8_CHARSET,
// GMime.set_user_charsets calls g_strdupv under the hood, so
// the array needs to be null-terminated
null
};
GMime.set_user_charsets(USER_CHARSETS);
try {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment