Browse Source

[Minor] Try to deal with broken CD headers

tags/3.1
Vsevolod Stakhov 2 years ago
parent
commit
064a12b377
2 changed files with 7 additions and 1 deletions
  1. 6
    0
      src/libmime/content_type.c
  2. 1
    1
      src/ragel/content_disposition_parser.rl

+ 6
- 0
src/libmime/content_type.c View 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);

+ 1
- 1
src/ragel/content_disposition_parser.rl View 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;
}

Loading…
Cancel
Save