From: Vsevolod Stakhov Date: Mon, 22 Aug 2022 21:35:13 +0000 (+0100) Subject: [Minor] Exclude irrelevant parts from mime_headers regexp X-Git-Tag: 3.3~62 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=189acef32f8c581a2c65bcb04306c3ea8585be9e;p=rspamd.git [Minor] Exclude irrelevant parts from mime_headers regexp --- diff --git a/src/libserver/re_cache.c b/src/libserver/re_cache.c index cb454d16d..a09d04e14 100644 --- a/src/libserver/re_cache.c +++ b/src/libserver/re_cache.c @@ -1178,6 +1178,12 @@ rspamd_re_cache_exec_re (struct rspamd_task *task, break; case RSPAMD_RE_MIMEHEADER: PTR_ARRAY_FOREACH (MESSAGE_FIELD (task, parts), i, mime_part) { + if (mime_part->parent_part == NULL || + !IS_PART_MULTIPART(mime_part->parent_part) || + IS_PART_MESSAGE(mime_part)) { + /* We filter parts that have no multipart parent or are a messages here */ + continue; + } rh = rspamd_message_get_header_from_hash(mime_part->raw_headers, re_class->type_data, FALSE);