• src/smblib/smbtxt.c

    From Rob Swindell (on Debian Linux)@1:103/705 to Git commit to main/sbbs/master on Wednesday, July 29, 2026 21:24:17
    https://gitlab.synchro.net/main/sbbs/-/commit/2b8e4cf5aaecfb834c50772f
    Modified Files:
    src/smblib/smbtxt.c
    Log Message:
    smblib: decode MIME attachments in nested multipart messages

    The boundary= parameter value was terminated only by ';' or a closing
    quote, never by the end of the header line. That is harmless for the
    top-level Content-Type, which comes from a NUL-terminated header field,
    but a nested part's Content-Type is a pointer into the raw message body:
    when boundary= is the last parameter on its folded line - what iOS Mail
    emits - every following header and body byte was swallowed into the
    boundary string, so no delimiter ever matched.

    Nested parts therefore yielded no attachments at all, and
    smb_getplaintext() could fail on the same messages, leaving the Terminal
    Server to display the entire raw MIME body - base64 and all - instead of
    the readable text.

    Terminate the value at the end of the header line as well, and bound the boundary= search to the part's own (possibly folded) Content-Type field:
    once CRLF terminates a value, an unbounded search would otherwise pick up
    a boundary= appearing later in the message text. Reject an empty
    boundary, which yields the string "--" and so matches the leading dashes
    of every delimiter as well as any "--" in the body. Also skip the white
    space RFC822 permits around the '=', and end an unquoted value at white
    space, which an RFC2046 boundary token cannot contain.

    GitLab #1205

    Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
    --- SBBSecho 3.37-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)