]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Do extra copy to ensure that original content is never touched
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 18 Apr 2017 09:03:05 +0000 (10:03 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 18 Apr 2017 09:03:35 +0000 (10:03 +0100)
src/libmime/mime_encoding.c

index 440dff35df698dba0e87a6267ae8552b3c4022ad..fdcd19c7bc2066667159cb5256aa0e56c6651b3d 100644 (file)
@@ -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) {