File evolution-data-server-boo1182882.patch of Package evolution-data-server.18664
From b0731961dca6ca2ee4a11b708545d58ff4948093 Mon Sep 17 00:00:00 2001
From: Milan Crha <mcrha@redhat.com>
Date: Tue, 2 Mar 2021 12:26:09 +0100
Subject: [PATCH] Allocate large-enough buffer for g_base64_decode_step()
Backported by Mike Gorse <mgorse@suse.com>
---
diff -urp evolution-data-server-3.22.7.orig/camel/camel-mime-filter-basic.c evolution-data-server-3.22.7/camel/camel-mime-filter-basic.c
--- evolution-data-server-3.22.7.orig/camel/camel-mime-filter-basic.c 2017-03-20 04:07:46.000000000 -0500
+++ evolution-data-server-3.22.7/camel/camel-mime-filter-basic.c 2021-03-05 15:04:19.082847738 -0600
@@ -88,7 +88,7 @@ mime_filter_basic_filter (CamelMimeFilte
break;
case CAMEL_MIME_FILTER_BASIC_BASE64_DEC:
/* output can't possibly exceed the input size */
- camel_mime_filter_set_size (mime_filter, len + 3, FALSE);
+ camel_mime_filter_set_size (mime_filter, (len * 3 / 4) + 3, FALSE);
newlen = g_base64_decode_step (
in, len,
(guchar *) mime_filter->outbuf,
@@ -230,7 +230,7 @@ mime_filter_basic_complete (CamelMimeFil
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);
+ camel_mime_filter_set_size (mime_filter, (len * 3 / 4) + 3, FALSE);
newlen = g_base64_decode_step (
in, len,
(guchar *) mime_filter->outbuf,
diff -urp evolution-data-server-3.22.7.orig/camel/camel-mime-utils.c evolution-data-server-3.22.7/camel/camel-mime-utils.c
--- evolution-data-server-3.22.7.orig/camel/camel-mime-utils.c 2017-03-20 04:07:46.000000000 -0500
+++ evolution-data-server-3.22.7/camel/camel-mime-utils.c 2021-03-05 15:04:59.023058617 -0600
@@ -1158,7 +1158,7 @@ rfc2047_decode_word (const gchar *in,
case 'B':
case 'b':
inptr += 2;
- decoded = g_alloca (inend - inptr);
+ decoded = g_alloca (((inend - inptr) * 3 / 4) + 3);
declen = g_base64_decode_step ((gchar *) inptr, inend - inptr, decoded, &state, &save);
break;
case 'Q':