commit bfbacbd: [CritFix] Fix parsing of the content type attributes

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Feb 17 17:07:06 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-02-17 17:05:05 +0000
URL: https://github.com/rspamd/rspamd/commit/bfbacbdb444a9fdef2d0a3f7c87a9d6b12f5a2d4

[CritFix] Fix parsing of the content type attributes

---
 src/libmime/content_type.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/src/libmime/content_type.c b/src/libmime/content_type.c
index 887800a3f..3de9bdb12 100644
--- a/src/libmime/content_type.c
+++ b/src/libmime/content_type.c
@@ -501,6 +501,25 @@ rspamd_content_type_parser (gchar *in, gsize len, rspamd_mempool_t *pool)
 						pname_end, c, c + qlen);
 			}
 
+			if (*p == '"') {
+				p ++;
+
+				if (p == end) {
+					/* Last quote: done... */
+					break;
+				}
+
+				if (*p == ';') {
+					p ++;
+					state = parse_space;
+					next_state = parse_param_name;
+					pname_start = NULL;
+					pname_end = NULL;
+					continue;
+				}
+			}
+
+			/* We should not normally be here in fact */
 			if (g_ascii_isspace (*p)) {
 				state = parse_space;
 				next_state = parse_param_name;


More information about the Commits mailing list