[evolution-data-server/gnome-3-26] Bug 789522 - Decode of empty base64 encoded part causes runtime warnings



commit ce3b8a3a1cd202aa93b9b6d7a1ad690be3dc69fb
Author: Milan Crha <mcrha redhat com>
Date:   Mon Jan 29 14:30:13 2018 +0100

    Bug 789522 - Decode of empty base64 encoded part causes runtime warnings

 src/camel/camel-mime-filter-basic.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/camel/camel-mime-filter-basic.c b/src/camel/camel-mime-filter-basic.c
index 6f7f000..2d7716b 100644
--- a/src/camel/camel-mime-filter-basic.c
+++ b/src/camel/camel-mime-filter-basic.c
@@ -229,8 +229,10 @@ mime_filter_basic_complete (CamelMimeFilter *mime_filter,
                g_return_if_fail (newlen <= (len + 2) * 2 + 62);
                break;
        case CAMEL_MIME_FILTER_BASIC_BASE64_DEC:
-               /* output can't possibly exceed the input size */
-               camel_mime_filter_set_size (mime_filter, len, FALSE);
+               /* Output can't possibly exceed the input size, but add 1,
+                  to make sure the mime_filter->outbuf will not be NULL,
+                  in case the input stream is empty. */
+               camel_mime_filter_set_size (mime_filter, len + 1, FALSE);
                newlen = g_base64_decode_step (
                        in, len,
                        (guchar *) mime_filter->outbuf,


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