diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-11-27 15:12:26 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-11-27 15:12:26 +0000 |
commit | 89849bda3097cf3b561e81b7ae10ca65509175ea (patch) | |
tree | d9a85ec0422fbb11459a917ba972900231621c31 /src | |
parent | d8c8fd5641a138cdf6e7dd6ee8dae39c4815cbae (diff) | |
download | rspamd-89849bda3097cf3b561e81b7ae10ca65509175ea.tar.gz rspamd-89849bda3097cf3b561e81b7ae10ca65509175ea.zip |
[CritFix] Make flags mutually exclusive for mime parts
Diffstat (limited to 'src')
-rw-r--r-- | src/libmime/archives.c | 25 | ||||
-rw-r--r-- | src/libmime/images.c | 7 |
2 files changed, 17 insertions, 15 deletions
diff --git a/src/libmime/archives.c b/src/libmime/archives.c index 52b796065..129863264 100644 --- a/src/libmime/archives.c +++ b/src/libmime/archives.c @@ -1531,20 +1531,19 @@ rspamd_archives_process (struct rspamd_task *task) for (i = 0; i < task->parts->len; i ++) { part = g_ptr_array_index (task->parts, i); - if (part->parsed_data.len > 0) { - if (rspamd_archive_cheat_detect (part, "zip", - zip_magic, sizeof (zip_magic))) { - rspamd_archive_process_zip (task, part); - } - else if (rspamd_archive_cheat_detect (part, "rar", - rar_magic, sizeof (rar_magic))) { - rspamd_archive_process_rar (task, part); - } - else if (rspamd_archive_cheat_detect (part, "7z", - sz_magic, sizeof (sz_magic))) { - rspamd_archive_process_7zip (task, part); + if (!(part->flags & (RSPAMD_MIME_PART_TEXT|RSPAMD_MIME_PART_IMAGE))) { + if (part->parsed_data.len > 0) { + if (rspamd_archive_cheat_detect (part, "zip", + zip_magic, sizeof (zip_magic))) { + rspamd_archive_process_zip (task, part); + } else if (rspamd_archive_cheat_detect (part, "rar", + rar_magic, sizeof (rar_magic))) { + rspamd_archive_process_rar (task, part); + } else if (rspamd_archive_cheat_detect (part, "7z", + sz_magic, sizeof (sz_magic))) { + rspamd_archive_process_7zip (task, part); + } } - } } } diff --git a/src/libmime/images.c b/src/libmime/images.c index 194f6e4e8..c4d20b4ad 100644 --- a/src/libmime/images.c +++ b/src/libmime/images.c @@ -49,9 +49,12 @@ rspamd_images_process (struct rspamd_task *task) for (i = 0; i < task->parts->len; i ++) { part = g_ptr_array_index (task->parts, i); - if (rspamd_ftok_cmp (&part->ct->type, &srch) == 0 && + + if (!(part->flags & (RSPAMD_MIME_PART_TEXT|RSPAMD_MIME_PART_ARCHIVE))) { + if (rspamd_ftok_cmp (&part->ct->type, &srch) == 0 && part->parsed_data.len > 0) { - process_image (task, part); + process_image (task, part); + } } } |