commit e0202bf: [Fix] Understand utf8 in content-disposition parser

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Sep 1 14:07:05 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-09-01 14:58:35 +0100
URL: https://github.com/rspamd/rspamd/commit/e0202bf46cc5e3641bec6a7e6b5b986ff6cc283d (HEAD -> master)

[Fix] Understand utf8 in content-disposition parser

---
 src/ragel/content_disposition.rl | 2 +-
 src/ragel/smtp_base.rl           | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/ragel/content_disposition.rl b/src/ragel/content_disposition.rl
index abcd7796f..ff00dce94 100644
--- a/src/ragel/content_disposition.rl
+++ b/src/ragel/content_disposition.rl
@@ -7,7 +7,7 @@
   balanced_ccontent := ccontent* ')' @{ fret; };
   comment        =   "(" (FWS? ccontent)* FWS? ")";
   CFWS           =   ((FWS? comment)+ FWS?) | FWS;
-  qcontent = qtextSMTP | quoted_pairSMTP;
+  qcontent = qtextSMTP | quoted_pairSMTP | textUTF8;
   quoted_string = CFWS?
                   (DQUOTE
                     (((FWS? qcontent)* FWS?) >Quoted_Str_Start %Quoted_Str_End)
diff --git a/src/ragel/smtp_base.rl b/src/ragel/smtp_base.rl
index c9cc91061..cb4f066bc 100644
--- a/src/ragel/smtp_base.rl
+++ b/src/ragel/smtp_base.rl
@@ -24,6 +24,11 @@
 
   quoted_pairSMTP  = "\\" 32..126;
   qtextSMTP      = 32..33 | 35..91 | 93..126;
+  utf8_cont = 0x80..0xbf;
+  utf8_2c   = 0xc0..0xdf utf8_cont;
+  utf8_3c   = 0xe0..0xef utf8_cont utf8_cont;
+  utf8_4c   = 0xf0..0xf7 utf8_cont utf8_cont utf8_cont;
+  textUTF8  = qtextSMTP | utf8_2c | utf8_3c | utf8_4c;
   Atom           = atext+;
   Dot_string     = Atom ("."  Atom)*;
   dot_atom_text  = atext+ ("." atext+)*;


More information about the Commits mailing list