[tin-dev] [PATCH] quoted pairs in CFWS are not ignored

Dennis Preiser dennis at d--p.de
Sun Oct 8 18:14:28 CEST 2017


tin fails to display the following article properly:

| Newsgroups: de.test
| Subject: Re: Überlange Zeile mit "😂 "
| Message-ID: <AABZ2kP/jGUAAA5p.A1s1.flnews at WStation7.micha.freeshell.org>
| 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
-------------- next part --------------
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;


More information about the tin-dev mailing list