]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Try to deal with broken CD headers
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 10 Sep 2021 19:18:44 +0000 (20:18 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 10 Sep 2021 19:18:44 +0000 (20:18 +0100)
src/libmime/content_type.c
src/ragel/content_disposition_parser.rl

index 88102ad2c59581a23578073321576b2c3ea50ea0..40f0fd3518b10a1763277d66556208cc74baa569 100644 (file)
@@ -832,6 +832,12 @@ rspamd_content_disposition_parse (const gchar *in,
        struct rspamd_content_disposition *res = NULL, val;
 
        if (rspamd_content_disposition_parser (in, len, &val, pool)) {
+
+               if (val.type == RSPAMD_CT_UNKNOWN) {
+                       /* 'Fix' type to attachment as MUA does */
+                       val.type = RSPAMD_CT_ATTACHMENT;
+               }
+
                res = rspamd_mempool_alloc (pool, sizeof (val));
                memcpy (res, &val, sizeof (val));
                res->lc_data = rspamd_mempool_alloc (pool, len + 1);
index cdef4db46dab30254c6bf84331871dda3577b66c..f1b0172b7cafe6cadf8ec6ff807ba35a3cab722c 100644 (file)
@@ -122,5 +122,5 @@ rspamd_content_disposition_parser (const char *data, size_t len, struct rspamd_c
     free (st_storage.data);
   }
 
-  return cd->type != RSPAMD_CT_UNKNOWN;
+  return cd->attrs != NULL || cd->type != RSPAMD_CT_UNKNOWN;
 }