• src/smblib/smbtxt.c

    From rswindell@VERT to CVS commit on Wednesday, August 08, 2018 22:14:00
    src/smblib smbtxt.c 1.32 1.33
    Update of /cvsroot/sbbs/src/smblib
    In directory cvs:/home/rswindell/sbbs/src/smblib

    Modified Files:
    smbtxt.c
    Log Message:
    Fix potential buffer overrun in mime_getattachment() when the MIME 'content-disposition' filename parameter is not terminated with a double-
    quote or semi-colon character.



    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From rswindell@VERT to CVS commit on Wednesday, August 08, 2018 22:23:00
    src/smblib smbtxt.c 1.33 1.34
    Update of /cvsroot/sbbs/src/smblib
    In directory cvs:/home/rswindell/sbbs/src/smblib

    Modified Files:
    smbtxt.c
    Log Message:
    Additional fix to mime_getattachment() - terminate the filename at the
    first white-space character encountered.



    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From rswindell@VERT to CVS commit on Sunday, April 28, 2019 06:23:00
    src/smblib smbtxt.c 1.40 1.41
    Update of /cvsroot/sbbs/src/smblib
    In directory cvs:/tmp/cvs-serv2655

    Modified Files:
    smbtxt.c
    Log Message:
    Correctly detect a "last boundary delimeter":
    --<boundary>--

    Without this change, some attachment (e.g. from gmail) would not be correctly decoded because gmail would not insert any blank lines between the end of the nested multipart/alternative part and the beginning of the attachment part: --000000000000d75a0f058779bbb2--
    --000000000000d75a12058779bbb4
    Content-Type: image/jpeg;
    name="29571163_1640947089321419_3376478908098884084_n.jpg" Content-Disposition: attachment;
    filename="29571163_1640947089321419_3376478908098884084_n.jpg" Content-Transfer-Encoding: base64

    It looks (from RFC2046) like boundary delimeters should actually be: "\r\n--<boundary>", but I'll look into that later.


    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From rswindell@VERT to CVS commit on Saturday, May 04, 2019 23:34:00
    src/smblib smbtxt.c 1.43 1.44
    Update of /cvsroot/sbbs/src/smblib
    In directory cvs:/tmp/cvs-serv21721

    Modified Files:
    smbtxt.c
    Log Message:
    Constify mime_getcontent() - don't modify the text buffer as that stops subsequent parsing (e.g. fall-back to html) to fail.


    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From rswindell@VERT to CVS commit on Saturday, May 04, 2019 23:45:00
    src/smblib smbtxt.c 1.44 1.45
    Update of /cvsroot/sbbs/src/smblib
    In directory cvs:/tmp/cvs-serv26237

    Modified Files:
    smbtxt.c
    Log Message:
    Support multipart/report MIME content-type, from RFC3462:
    The syntax of Multipart/Report is identical to the Multipart/Mixed content type


    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From rswindell@VERT to CVS commit on Sunday, May 05, 2019 11:12:00
    src/smblib smbtxt.c 1.45 1.46
    Update of /cvsroot/sbbs/src/smblib
    In directory cvs:/home/rswindell/sbbs/src/smblib

    Modified Files:
    smbtxt.c
    Log Message:
    Added NULL pointer (strdup failure) check for good measure.



    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From rswindell@VERT to CVS commit on Monday, May 06, 2019 01:33:00
    src/smblib smbtxt.c 1.46 1.47
    Update of /cvsroot/sbbs/src/smblib
    In directory cvs:/tmp/cvs-serv17219

    Modified Files:
    smbtxt.c
    Log Message:
    MIME header fields are case-insensitive. <sigh>
    So replace some strstr() calls with either (new local function) strStartWith_i()
    or strcasestr(), depending.
    strStartWith_i() return length of the matched word, so no need to sprinkle about magic numeric constants everywhere. The extra calls to strlen() are worth the code clarity / reliability, methinks.
    TODO: find out if there's a way to calculate the length of string-constants at compile-time (?).


    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From rswindell@VERT to CVS commit on Tuesday, November 19, 2019 22:04:55
    src/smblib smbtxt.c 1.48 1.49
    Update of /cvsroot/sbbs/src/smblib
    In directory cvs:/home/rswindell/sbbs/src/smblib

    Modified Files:
    smbtxt.c
    Log Message:
    Fix bug with MIME-attachment filename parsing when the filename is not terminated with either a double-quote or a semicolon character. If not
    enclosed in quotes, terminate on the first white-space char following the filename=.



    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell@VERT to Git commit to sbbs/master on Thursday, November 12, 2020 01:55:49
    https://gitlab.synchro.net/sbbs/sbbs/-/commit/ad79c5916f7ccb3ea989eb8f
    Modified Files:
    src/smblib/smbtxt.c
    Log Message:
    Improved parsing of "charset" parameter in MIME Content-Type header.

    In Issue #177, the reported problem message header was "Content-Type: text/plain; charset=utf-8; format=flowed"
    The fact that the "charset" value was not quoted and not space delimited means the charset would have been parsed as "utf-8;", which would not provide an exact match (against "utf-8") in smb_msg_is_utf8() and thus the message body would not be considered to be utf-8 encoded.

    The solution is to terminate the "charset" parameter value at the semicolon, if it exists, and the value was not quoted.

    Also, for good measure, only search for " charset" or ";charset" to avoid false-positive parameter matches, like "notcharset".

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell@VERT to Git commit to sbbs/master on Thursday, November 12, 2020 04:47:42
    https://gitlab.synchro.net/sbbs/sbbs/-/commit/6dd2aedbb8eaf5a939951bc1
    Modified Files:
    src/smblib/smbtxt.c
    Log Message:
    Fix crashing bug introduced in previous commit of this file

    Don't pass NULL to strcasestr().

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell@VERT to Git commit to main/sbbs/master on Thursday, December 10, 2020 09:33:34
    https://gitlab.synchro.net/main/sbbs/-/commit/0c68700b9eab611daa7c0510
    Modified Files:
    src/smblib/smbtxt.c
    Log Message:
    Include comment headers in smb_getmsgtxt() returned buffer

    even when GETMSGTXT_PLAIN mode flag is used and the message contains a MIME-encoded plain-text portion. Obviously the GETMSGTXT_NO_HFIELDS exception still applies.

    The fixed problem was when forwarding a MIME-encoded email, the forwarding information (and user comment, if supplied) could be suppressed/lost.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell@VERT to Git commit to main/sbbs/master on Thursday, January 21, 2021 10:04:00
    https://gitlab.synchro.net/main/sbbs/-/commit/7b05a61321b1d432e9503924
    Modified Files:
    src/smblib/smbtxt.c
    Log Message:
    Fix new GCC warning about return type.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell@VERT to Git commit to main/sbbs/master on Saturday, January 23, 2021 09:18:32
    https://gitlab.synchro.net/main/sbbs/-/commit/d23ad38ab8face340c90f118
    Modified Files:
    src/smblib/smbtxt.c
    Log Message:
    Fix heap corruption in smb_getattachment() for blank attachments

    MSVC detected heap corruption from this function when the attachment was 0-bytes in length. Good catch.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net