[PATCH] quoted pairs in CFWS are not ignored
Dennis Preiser <[email protected]> Sun, 8 Oct 2017 18:14:28 +0200
| Newsgroups | gmane.network.tin.devel |
|---|---|
| Message-ID | <[email protected]> |
--qMm9M+Fa2AknHoGS Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit tin fails to display the following article properly: | Newsgroups: de.test | Subject: Re: Überlange Zeile mit "😂 " | Message-ID: <AABZ2kP/[email protected]> | Content-Type: (Comment(\)))text/plain(Comment) ; | charset(Bla)=UTF-8 | (Unicode); | format=(\)Blubb)flowed; | delsp=yes | Content-Transfer-Encoding: 8bit According to RFC 5322, CFWS can contain quoted pairs: | FWS = ([*WSP CRLF] 1*WSP) / obs-FWS | ; Folding white space | | ctext = %d33-39 / ; Printable US-ASCII | %d42-91 / ; characters not including | %d93-126 / ; "(", ")", or "\" | obs-ctext | | ccontent = ctext / quoted-pair / comment | | comment = "(" *([FWS] ccontent) [FWS] ")" | | CFWS = (1*([FWS] comment) [FWS]) / FWS In src/rfc2046.c:remove_cwsp() we do not skip over those quoted pairs and thus the opening and closing brackets in the Content-Type:-header of the article remain unbalanced. The attached patch should fix this. Dennis --qMm9M+Fa2AknHoGS Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="2017-10-08.diff" diff -urp tin-2.4.2/src/rfc2046.c tin-2.4.2_r1/src/rfc2046.c --- tin-2.4.2/src/rfc2046.c 2017-09-26 21:33:31.000000000 +0200 +++ tin-2.4.2_r1/src/rfc2046.c 2017-10-08 18:03:59.000000000 +0200 @@ -232,6 +232,11 @@ remove_cwsp( } if (!inquotes) { + /* skip over quoted pairs */ + if (src == '\\') { + ++from; + continue; + } if (src == '(') { ++c_cnt; continue; --qMm9M+Fa2AknHoGS Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KdGluLWRldiBt YWlsaW5nIGxpc3QKdGluLWRldkB0aW4ub3JnCmh0dHA6Ly9saXN0cy50aW4ub3JnL2NnaS1iaW4v bWFpbG1hbi9saXN0aW5mby90aW4tZGV2Cg== --qMm9M+Fa2AknHoGS--