NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/47395: mail(1) unnecessarily uses base64 if a CR without a LF is seen



>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:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 03 18:50:00 +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;



Home | Main Index | Thread Index | Old Index