commit def2916: [Minor] Add case sensivity for file names in case of CT attribute

Vsevolod Stakhov vsevolod at highsecure.ru
Thu Oct 8 12:28:06 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-10-08 13:21:27 +0100
URL: https://github.com/rspamd/rspamd/commit/def2916b44a2c314d270378298b4e8b052417c97 (HEAD -> master)

[Minor] Add case sensivity for file names in case of CT attribute

---
 src/libmime/content_type.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

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 (&param->name, &srch) == 0) {
+	if (rspamd_ftok_icase_equal (&param->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 (&param->name, &srch) == 0) {
+	if (rspamd_ftok_icase_equal (&param->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 (&param->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 (&param->name, &srch) == 0) {
+	if (rspamd_ftok_icase_equal (&param->name, &srch)) {
 		/* Adjust filename */
 		cd->filename.begin = param->value.begin;
 		cd->filename.len = param->value.len;


More information about the Commits mailing list