From: Vsevolod Stakhov Date: Tue, 18 Apr 2017 09:03:05 +0000 (+0100) Subject: [Fix] Do extra copy to ensure that original content is never touched X-Git-Tag: 1.5.6~6 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f3c9fac98382f0e2fc6da1033117f2ee368e4cad;p=rspamd.git [Fix] Do extra copy to ensure that original content is never touched --- 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) {