commit ca04d24: [Feature] Strip smtp comments from message id

Vsevolod Stakhov vsevolod at highsecure.ru
Fri Jun 18 12:42:05 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-06-18 13:38:21 +0100
URL: https://github.com/rspamd/rspamd/commit/ca04d2496d83ba59100e0ab93f7f7a7479322d3a (HEAD -> master)

[Feature] Strip smtp comments from message id

---
 src/libmime/mime_headers.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/libmime/mime_headers.c b/src/libmime/mime_headers.c
index 0bca94024..71b4f2688 100644
--- a/src/libmime/mime_headers.c
+++ b/src/libmime/mime_headers.c
@@ -44,7 +44,7 @@ rspamd_mime_header_check_special (struct rspamd_task *task,
 	struct rspamd_received_header *recv;
 	const gchar *p, *end;
 	gchar *id;
-	gint max_recipients = -1;
+	gint max_recipients = -1, len;
 
 	if (task->cfg) {
 		max_recipients = task->cfg->max_recipients;
@@ -93,7 +93,9 @@ rspamd_mime_header_check_special (struct rspamd_task *task,
 
 		rh->flags = RSPAMD_HEADER_MESSAGE_ID|RSPAMD_HEADER_UNIQUE;
 		p = rh->decoded;
-		end = p + strlen (p);
+		len = rspamd_strip_smtp_comments_inplace(rh->decoded, strlen(p));
+		rh->decoded[len] = '\0'; /* Zero terminate after stripping */
+		end = p + len;
 
 		if (*p == '<') {
 			p++;


More information about the Commits mailing list