From 81e52c9cdfd9833c7a0a3b340b779a09d9d9d4e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net> Date: Wed, 17 Mar 2021 13:13:50 -0400 Subject: [PATCH] Work around exception on spammy mail... Don't include the obsolete unstructured regex in abs.unstrctured, and use the abnf.unstructured for parsing headers. This fixes an issue seen running the IMAP server on gratuitously spammy messages. --- exec/load/mime.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/exec/load/mime.js b/exec/load/mime.js index b99e34ea53..6d297797f7 100644 --- a/exec/load/mime.js +++ b/exec/load/mime.js @@ -354,7 +354,8 @@ abnf.obs_phrase="(?:"+abnf.word+"(?:"+abnf.word+"|\\.|"+abnf.CFWS+")*)"; abnf.phrase=abnf.obs_phrase; // 3.2.5 Miscellaneous Tokens -abnf.unstructured=abnf.obs_unstruct; +//abnf.unstructured=abnf.obs_unstruct; +abnf.unstructured="(?:(?:"+abnf.FWS+"?"+abnf.VCHAR+")*"+abnf.WSP+"*)"; // 3.3 Date and Time Specification abnf.day_name="(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)"; @@ -603,7 +604,7 @@ function parse_header(str) var m; var re; - re=new RegExp("^("+abnf.field_name+")"+abnf.WSP+"*:"+rfc5322abnf.unstructured+""+abnf.CRLF,"i"); + re=new RegExp("^("+abnf.field_name+")"+abnf.WSP+"*:"+abnf.unstructured+""+abnf.CRLF,"i"); m=re.exec(str); if(m==null) return(undefined); @@ -826,4 +827,4 @@ function parse_mime(hdrs, text) } // Leave as last line: -this; \ No newline at end of file +this; -- GitLab