NetBSD Problem Report #47395

From www@NetBSD.org  Thu Jan  3 18:49:31 2013
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id 074C763E615
	for <gnats-bugs@gnats.NetBSD.org>; Thu,  3 Jan 2013 18:49:31 +0000 (UTC)
Message-Id: <20130103184929.E62DA63E615@www.NetBSD.org>
Date: Thu,  3 Jan 2013 18:49:29 +0000 (UTC)
From: sdaoden@gmail.com
Reply-To: sdaoden@gmail.com
To: gnats-bugs@NetBSD.org
Subject: mail(1) unnecessarily uses base64 if a CR without a LF is seen
X-Send-Pr-Version: www-1.0

>Number:         47395
>Category:       bin
>Synopsis:       mail(1) unnecessarily uses base64 if a CR without a LF is seen
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 03 18:50:00 +0000 2013
>Closed-Date:    Fri Jan 04 08:16:11 +0000 2013
>Last-Modified:  Fri Jan 04 08:16:11 +0000 2013
>Originator:     Steffen
>Release:        git trunk sources
>Organization:
>Environment:
That is 6.0 RELEASE
>Description:
If i read the RFCs correctly it is not necessary to use base64 if a CR occurs outside of a CRLF pair, as long as it actually is encoded.
Given the size increasement i think QP is more useful than base64.
>How-To-Repeat:
That is not so easy in the real world.
>Fix:
--- mime_attach.c.orig  2013-01-03 19:26:26.000000000 +0100
+++ mime_attach.c       2013-01-03 19:34:29.000000000 +0100
@@ -236,7 +236,7 @@ content_encoding_core(void *fh, const ch
        while ((c = fgetc(fh)) != EOF) {
                curlen++;

-               if (c == '\0' || (lastc == '\r' && c != '\n'))
+               if (c == '\0')
                        return MIME_TRANSFER_BASE64;

                if (c > 0x7f) {
@@ -252,7 +252,7 @@ content_encoding_core(void *fh, const ch
                                maxlen = curlen;
                        curlen = 0;
                }
-               else if ((c < 0x20 && c != '\t') || c == 0x7f)
+               else if ((c < 0x20 && c != '\t') || c == 0x7f || lastc == '\r')
                        ctrlchar = 1;

                lastc = c;

>Release-Note:

>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/47395 CVS commit: src/usr.bin/mail
Date: Thu, 3 Jan 2013 20:43:59 -0500

 Module Name:	src
 Committed By:	christos
 Date:		Fri Jan  4 01:43:59 UTC 2013

 Modified Files:
 	src/usr.bin/mail: mime_attach.c

 Log Message:
 PR/47395: Steffen: mail(1) unnecessarily uses base64 if a CR without a LF is seen


 To generate a diff of this commit:
 cvs rdiff -u -r1.14 -r1.15 src/usr.bin/mail/mime_attach.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Fri, 04 Jan 2013 08:16:11 +0000
State-Changed-Why:
christos committed it, thanks.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.