]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] Strip smtp comments from message id
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 18 Jun 2021 12:38:21 +0000 (13:38 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 18 Jun 2021 12:38:21 +0000 (13:38 +0100)
src/libmime/mime_headers.c

index 0bca94024e8b6623dbfd295bbd5af536ae0c1b96..71b4f2688d0b372ecff3fb10413f613b94d8c02a 100644 (file)
@@ -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++;