aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-06-25 11:11:52 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-06-25 11:11:52 +0100
commitad5850db20e6f66a1d9a7314d227f9eec296e9f0 (patch)
tree67460543446b1c52d97449e51d7e2aeb5f8a9b8e /src
parentd708a7a7e6038a2c2e68ba06af88c3a810c4e34e (diff)
downloadrspamd-ad5850db20e6f66a1d9a7314d227f9eec296e9f0.tar.gz
rspamd-ad5850db20e6f66a1d9a7314d227f9eec296e9f0.zip
[Minor] Lowercase content-type as specified in rfc2045
Diffstat (limited to 'src')
-rw-r--r--src/libmime/content_type.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/libmime/content_type.c b/src/libmime/content_type.c
index d092c0dc4..11fa8cd65 100644
--- a/src/libmime/content_type.c
+++ b/src/libmime/content_type.c
@@ -597,8 +597,26 @@ rspamd_content_type_parser (gchar *in, gsize len, rspamd_mempool_t *pool)
}
if (val.type.len > 0) {
+ gchar *tmp;
+
res = rspamd_mempool_alloc (pool, sizeof (val));
memcpy (res, &val, sizeof (val));
+
+ /*
+ * Lowercase type and subtype as they are specified as case insensitive
+ * in rfc2045 section 5.1
+ */
+ tmp = rspamd_mempool_alloc (pool, val.type.len);
+ memcpy (tmp, val.type.begin, val.type.len);
+ rspamd_str_lc (tmp, val.type.len);
+ res->type.begin = tmp;
+
+ if (val.subtype.len > 0) {
+ tmp = rspamd_mempool_alloc (pool, val.subtype.len);
+ memcpy (tmp, val.subtype.begin, val.subtype.len);
+ rspamd_str_lc (tmp, val.subtype.len);
+ res->subtype.begin = tmp;
+ }
}
return res;