From 47acf5bbc1c00cd42f9ee1d6fd290ee410e9c45b Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 28 Apr 2016 15:05:28 +0100 Subject: [PATCH] [CritFix] Fix SA rawbody processing - exclude top part --- src/libserver/re_cache.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/libserver/re_cache.c b/src/libserver/re_cache.c index db57c0db9..be7394c44 100644 --- a/src/libserver/re_cache.c +++ b/src/libserver/re_cache.c @@ -959,6 +959,15 @@ rspamd_re_cache_exec_re (struct rspamd_task *task, for (i = 0; i < task->parts->len; i++) { mime_part = g_ptr_array_index (task->parts, i); + if (mime_part->parent == NULL) { + /* Top level part */ + scvec[i * 2 + 1] = (guchar *)""; + lenvec[i * 2 + 1] = 0; + scvec[i * 2 + 2] = (guchar *)""; + lenvec[i * 2 + 2] = 0; + continue; + } + if (mime_part->raw_headers_str) { scvec[i * 2 + 1] = (guchar *)mime_part->raw_headers_str; lenvec[i * 2 + 1] = strlen (mime_part->raw_headers_str); -- 2.39.5