]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Exclude irrelevant parts from mime_headers regexp
authorVsevolod Stakhov <vsevolod@rspamd.com>
Mon, 22 Aug 2022 21:35:13 +0000 (22:35 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Mon, 22 Aug 2022 21:35:13 +0000 (22:35 +0100)
src/libserver/re_cache.c

index cb454d16dbf97b7c83752bfea7e03d86fbf8a21a..a09d04e149c1a3bb20f57a4abe895697c3a53d69 100644 (file)
@@ -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);