commit 189acef: [Minor] Exclude irrelevant parts from mime_headers regexp

Vsevolod Stakhov vsevolod at rspamd.com
Mon Aug 22 21:42:03 UTC 2022


Author: Vsevolod Stakhov
Date: 2022-08-22 22:35:13 +0100
URL: https://github.com/rspamd/rspamd/commit/189acef32f8c581a2c65bcb04306c3ea8585be9e (HEAD -> master)

[Minor] Exclude irrelevant parts from mime_headers regexp

---
 src/libserver/re_cache.c | 6 ++++++
 1 file changed, 6 insertions(+)

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);
 


More information about the Commits mailing list