[gmime: 1/24] Fixed g_mime_part_set_encoding when encoding is DEFAULT



commit c37d462dab3199cf7cb6df535b78e134ce7f8486
Author: Jeffrey Stedfast <jestedfa microsoft com>
Date:   Thu Jun 22 12:58:07 2017 -0400

    Fixed g_mime_part_set_encoding when encoding is DEFAULT
    
    When the encoding is DEFAULT, the string value is NULL which
    was causing g_mime_header_list_set() to abort.
    
    Instead, what this code needs to do is call g_mime_header_list_remove()
    in that case.
    
    Thanks to Peter Bloomfield of Balsa fame for spotting this issue.

 gmime/gmime-part.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/gmime/gmime-part.c b/gmime/gmime-part.c
index 520a490..677bc98 100644
--- a/gmime/gmime-part.c
+++ b/gmime/gmime-part.c
@@ -788,7 +788,10 @@ g_mime_part_set_content_encoding (GMimePart *mime_part, GMimeContentEncoding enc
        mime_part->encoding = encoding;
        
        _g_mime_object_block_header_list_changed (object);
-       g_mime_header_list_set (object->headers, "Content-Transfer-Encoding", value, NULL);
+       if (value != NULL)
+               g_mime_header_list_set (object->headers, "Content-Transfer-Encoding", value, NULL);
+       else
+               g_mime_header_list_remove (object->headers, "Content-Transfer-Encoding");
        _g_mime_object_block_header_list_changed (object);
 }
 


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