nmh-workers
[Top] [All Lists]

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

2014-05-07 20:12:15
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, pgf(_at_)foxharp(_dot_)boston(_dot_)ma(_dot_)us (arlington, ma, 
where it's 54.3 degrees)

_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>