[geary/geary-0.13] Merge branch 'wip/225-gmime-charset-crash' into 'master'



commit 68916e87bc5145354a70aee4abad585ed885f90f
Author: Michael Gratton <mike vee net>
Date:   Thu Feb 21 01:14:46 2019 +0000

    Merge branch 'wip/225-gmime-charset-crash' into 'master'
    
    Fix crash in Geary.RFC822.init()
    
    Closes #225
    
    See merge request GNOME/geary!125
    
    (cherry picked from commit 8a3649952e901252c28cd6f5dbef4dbce61cc780)
    
    e06ec5e7 Fix crash in Geary.RFC822.init()

 src/engine/rfc822/rfc822.vala | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/src/engine/rfc822/rfc822.vala b/src/engine/rfc822/rfc822.vala
index 49b9e05d..1c05dc9f 100644
--- a/src/engine/rfc822/rfc822.vala
+++ b/src/engine/rfc822/rfc822.vala
@@ -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 {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]