nmh-workers
[Top][All Lists]
Advanced

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

Re: [Nmh-workers] corruption when attaching all-null files


From: Paul Fox
Subject: Re: [Nmh-workers] corruption when attaching all-null files
Date: Wed, 07 May 2014 20:11:51 -0400

okay.  so i've changed scan_content to use getline(), so that it
can now look for NULs and flag them.

here's the place where the new "containsnul" is used, for CT_TEXT
and CT_APPLICATION.

is the sufficient, and correct?

    /* 
     * Decide which transfer encoding to use. 
     */

    if (ct->c_reqencoding != CE_UNKNOWN)
        ct->c_encoding = ct->c_reqencoding;
    else
        switch (ct->c_type) {
        case CT_TEXT:
            if (contains8bit && !containsnul && !linelen && !linespace && 
!checksw)
                ct->c_encoding = CE_8BIT;
            else if (contains8bit || containsnul || linelen || linespace || 
checksw)
                ct->c_encoding = CE_QUOTED;
            else
                ct->c_encoding = CE_7BIT;
            break;

        case CT_APPLICATION:
            /* For application type, use base64, except when postscript */
            if (containsnul || contains8bit || linelen || linespace || checksw)
                ct->c_encoding = (ct->c_subtype == APPLICATION_POSTSCRIPT)
                    ? CE_QUOTED : CE_BASE64;
            else
                ct->c_encoding = CE_7BIT;
            break;

        case CT_MESSAGE:
            ct->c_encoding = contains8bit ? CE_8BIT : CE_7BIT;
            break;

        case CT_AUDIO:
        case CT_IMAGE:
        case CT_VIDEO:
            /* For audio, image, and video contents, just use base64 */
            ct->c_encoding = CE_BASE64;
            break;
        }

(in addition, once CE_QUOTED was selected for text parts containing
NULs, it became necessary to fix writeQuoted() to be able to deal
with those NULs, so i've done that too.  and added some new tests.)

paul
----------------------
 paul fox, address@hidden (arlington, ma, where it's 54.3 degrees)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]