Add a wrapper function to decode base64, returning a null-terminated string.
[claws.git] / src / unmime.c
index 2054c14f808a7990ec458e1967ac7ec0c22b1f6f..984897754a85619d62a6c18a4ce7530a73245a18 100644 (file)
@@ -27,7 +27,6 @@
 #include <ctype.h>
 
 #include "codeconv.h"
-#include "base64.h"
 #include "quoted-printable.h"
 
 #define ENCODED_WORD_BEGIN     "=?"
@@ -112,11 +111,10 @@ gchar *unmime_header(const gchar *encoded_str, gboolean addr_field)
                encoding = g_ascii_toupper(*(encoding_begin_p + 1));
 
                if (encoding == 'B') {
-                       decoded_text = g_malloc
-                               (eword_end_p - (text_begin_p + 1) + 1);
-                       len = base64_decode(decoded_text, text_begin_p + 1,
-                                           eword_end_p - (text_begin_p + 1));
-                       decoded_text[len] = '\0';
+                       gchar *tmp;
+                       tmp = g_strndup(text_begin_p + 1, eword_end_p - (text_begin_p + 1) + 1);
+                       decoded_text = g_base64_decode_zero(tmp, &out_len);
+                       g_free(tmp);
                } else if (encoding == 'Q') {
                        decoded_text = g_malloc
                                (eword_end_p - (text_begin_p + 1) + 1);