From: Vsevolod Stakhov Date: Thu, 8 Oct 2020 12:21:27 +0000 (+0100) Subject: [Minor] Add case sensivity for file names in case of CT attribute X-Git-Tag: 2.7~253 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=def2916b44a2c314d270378298b4e8b052417c97;p=rspamd.git [Minor] Add case sensivity for file names in case of CT attribute --- diff --git a/src/libmime/content_type.c b/src/libmime/content_type.c index 1540e6b23..0c06f51fb 100644 --- a/src/libmime/content_type.c +++ b/src/libmime/content_type.c @@ -242,7 +242,7 @@ rspamd_content_type_postprocess (rspamd_mempool_t *pool, RSPAMD_FTOK_ASSIGN (&srch, "charset"); - if (rspamd_ftok_casecmp (¶m->name, &srch) == 0) { + if (rspamd_ftok_icase_equal (¶m->name, &srch)) { /* Adjust charset */ found = param; ct->charset.begin = param->value.begin; @@ -251,7 +251,7 @@ rspamd_content_type_postprocess (rspamd_mempool_t *pool, RSPAMD_FTOK_ASSIGN (&srch, "boundary"); - if (rspamd_ftok_casecmp (¶m->name, &srch) == 0) { + if (rspamd_ftok_icase_equal (¶m->name, &srch)) { found = param; gchar *lc_boundary; /* Adjust boundary */ @@ -266,8 +266,11 @@ rspamd_content_type_postprocess (rspamd_mempool_t *pool, } if (!found) { - /* Just lowercase */ - rspamd_str_lc ((gchar *)param->value.begin, param->value.len); + RSPAMD_FTOK_ASSIGN (&srch, "name"); + if (!rspamd_ftok_icase_equal (¶m->name, &srch)) { + /* Just lowercase */ + rspamd_str_lc ((gchar *) param->value.begin, param->value.len); + } } } @@ -282,7 +285,7 @@ rspamd_content_disposition_postprocess (rspamd_mempool_t *pool, srch.begin = "filename"; srch.len = 8; - if (rspamd_ftok_casecmp (¶m->name, &srch) == 0) { + if (rspamd_ftok_icase_equal (¶m->name, &srch)) { /* Adjust filename */ cd->filename.begin = param->value.begin; cd->filename.len = param->value.len;