Re: [PATCH] quoted pairs in CFWS are not ignored

Dennis Preiser <[email protected]> Sun, 8 Oct 2017 18:32:25 +0200
Newsgroups gmane.network.tin.devel
Message-ID <[email protected]>
--/NkBOFFp2J2Af1nK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Sun, Oct 08, 2017 at 06:14:28PM +0200, Dennis Preiser wrote:
> 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.

Attached to a revised version that skips quoted pairs only within a comment.

Dennis

--/NkBOFFp2J2Af1nK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="2017-10-08_2.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:25:00.000000000 +0200
@@ -232,6 +232,11 @@ remove_cwsp(
 		}
 
 		if (!inquotes) {
+			/* skip over quoted pairs */
+			if (c_cnt && src == '\\') {
+				++from;
+				continue;
+			}
 			if (src == '(') {
 				++c_cnt;
 				continue;

--/NkBOFFp2J2Af1nK
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KdGluLWRldiBt
YWlsaW5nIGxpc3QKdGluLWRldkB0aW4ub3JnCmh0dHA6Ly9saXN0cy50aW4ub3JnL2NnaS1iaW4v
bWFpbG1hbi9saXN0aW5mby90aW4tZGV2Cg==

--/NkBOFFp2J2Af1nK--