summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-04-18 10:03:05 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-04-18 10:03:35 +0100
commitf3c9fac98382f0e2fc6da1033117f2ee368e4cad (patch)
tree596530ad909ca4a57e7cbfddd356cf315678cb7f
parentb84aa7ae331020608070b41c4946643cc73d01df (diff)
downloadrspamd-f3c9fac98382f0e2fc6da1033117f2ee368e4cad.tar.gz
rspamd-f3c9fac98382f0e2fc6da1033117f2ee368e4cad.zip
[Fix] Do extra copy to ensure that original content is never touched
-rw-r--r--src/libmime/mime_encoding.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libmime/mime_encoding.c b/src/libmime/mime_encoding.c
index 440dff35d..fdcd19c7b 100644
--- a/src/libmime/mime_encoding.c
+++ b/src/libmime/mime_encoding.c
@@ -469,7 +469,9 @@ rspamd_mime_text_part_maybe_convert (struct rspamd_task *task,
struct rspamd_mime_part *part = text_part->mime_part;
part_content = rspamd_mempool_alloc0 (task->task_pool, sizeof (GByteArray));
- part_content->data = (guint8 *)text_part->parsed.begin;
+ part_content->data = rspamd_mempool_alloc (task->task_pool,
+ text_part->parsed.len);
+ memcpy (part_content->data, text_part->parsed.begin, text_part->parsed.len);
part_content->len = text_part->parsed.len;
if (task->cfg && task->cfg->raw_mode) {