1. 14 Mar, 2022 2 commits
    • Rob Swindell's avatar
      Fix heap corruption of qp_decode() · 6895c8da
      Rob Swindell authored
      qp_decode (quoted-printable in-place decode of a string) could write 2 characters *beyond* the allocated buffer by appending "\r\n" to a string that was not quoted-printable in the first place. i.e. the  contents of buf were not actually changed in the decode loop. This could result in a corrupted heap and crash of sbbs or smbutil when reading such a message.
      
      This change may result in a lack of CRLF appended to decoded plain text output, so we'll have to keep an eye out for that and resolve it some other way. One possibility could be to only append the CRLF if the destination pointer is sufficiently behind the source pointer.
      
      This solves the crash that Kirkman reported with a specific message in his "mail" base. The header for the message said it was quoted-printable encoded, but the body text was not actually encoded at all:
      OtherHeader      Content-Type: text/plain; charset="iso-8859-1"
      OtherHeader      MIME-Version: 1.0
      OtherHeader      Content-Transfer-Encoding: quoted-printable
      6895c8da
    • Rob Swindell's avatar
      3503816f
  2. 23 Jan, 2021 1 commit
  3. 21 Jan, 2021 2 commits
    • Rob Swindell's avatar
      Fix new GCC warning about return type. · 7b05a613
      Rob Swindell authored
      7b05a613
    • Rob Swindell's avatar
      Support single-part MIME-encoded messages in SMBLIB · c90ba307
      Rob Swindell authored
      This involved the removal of the content-transfer-decoding feature of the SMTP mail server since we need single-part MIME-attached file contents to be stored in their original encoded form (e.g. base64-encoded) and not in binary, for the message body text (where NULs aren't allowed, CR/LF is appended, etc).
      
      I accidentally made this change to smbtxt.c in the new_file_base branch and then copied over here, so there's some unrelated innocuous changes (comment header, removal of SMBCALL) that hopefully won't cause a merge conflict later.
      
      I don't actually receive single-part MIME attached files, so depending on others (e.g. Nelgin and Dream Master) to test for me.
      c90ba307
  4. 11 Dec, 2020 1 commit
    • Rob Swindell's avatar
      Support forwarding of single-part HTML emails, add "Fwd:" subject prefix · d79e9514
      Rob Swindell authored
      When forwarding a single-part MIME-encoded HTML email, the preamble (original message header info) and any user comments, need to be HTML-encoded.
      
      Add the commonly-used "Fwd: " prefix to the default message subject, when forwarding.
      
      This required that smb_getplaintext() no longer always-NULLify the message's text_subtype (e.g. "html"). For single-part messages, this element was getting freed and NULLed.
      
      Add/use a new SMBLIB convenience function to add a string header field, but only if non-NULL: smb_hfield_string()
      d79e9514
  5. 10 Dec, 2020 1 commit
    • Rob Swindell's avatar
      Include comment headers in smb_getmsgtxt() returned buffer · 0c68700b
      Rob Swindell authored
      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.
      0c68700b
  6. 12 Nov, 2020 2 commits
    • Rob Swindell's avatar
      Fix crashing bug introduced in previous commit of this file · 6dd2aedb
      Rob Swindell authored
      Don't pass NULL to strcasestr().
      6dd2aedb
    • Rob Swindell's avatar
      Improved parsing of "charset" parameter in MIME Content-Type header. · ad79c591
      Rob Swindell authored
      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".
      ad79c591
  7. 06 Nov, 2020 1 commit
    • Rob Swindell's avatar
      Replace ctype.h function calls with new MSVC-safe XPDEV macros · 8a7b7308
      Rob Swindell authored
      I'm fed-up with MSVC assertions in ctype functions (e.g. isdigit, isprint, isspace, etc.) when called with out-of-range (e.g. negative) values.
      
      This problem only affects MSVC debug builds, but if you run them (like I do), these things are like little time bombs that can drive you crazy (knocking your board out of service).
      
      The new macros names are bit more descriptive as well.
      8a7b7308
  8. 16 Aug, 2020 1 commit
  9. 19 Nov, 2019 1 commit
  10. 29 Jun, 2019 1 commit
  11. 06 May, 2019 1 commit
    • rswindell's avatar
      MIME header fields are case-insensitive. <sigh> · 7c0dbbb4
      rswindell authored
      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 (?).
      7c0dbbb4
  12. 05 May, 2019 1 commit
  13. 04 May, 2019 3 commits
  14. 30 Apr, 2019 1 commit
  15. 28 Apr, 2019 1 commit
    • rswindell's avatar
      Correctly detect a "last boundary delimeter": · 1cbfce29
      rswindell authored
      --<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.
      1cbfce29
  16. 11 Apr, 2019 2 commits
  17. 10 Apr, 2019 4 commits
  18. 08 Aug, 2018 2 commits
  19. 20 Feb, 2018 1 commit
  20. 28 Nov, 2017 2 commits
  21. 27 Nov, 2017 3 commits
  22. 26 Nov, 2017 1 commit
  23. 25 Nov, 2017 1 commit
  24. 29 Nov, 2016 2 commits
  25. 18 Nov, 2016 1 commit
    • rswindell's avatar
      Introduced 2 new poll concepts: · 5ea459df
      rswindell authored
      - Closures (polls can be closed for new voting by the pollster)
      - Results can have configurable visibility:
        a. Only to voters (and the pollster) - the default
        b. Everyone
        c. Everyone once the poll has closed
        d. Only the pollster
      
      Changes to smb_getmsgtxt():
      Main change: poll questions can now be quoted when replying to a posted poll
      (the results cannot be quoted).
      Also: there's now automatically a blank line inserted between comment header
      fields and poll answers or the msg body text.
      Also: upon any malloc failure, the function now returns NULL.
      New functions: smb_msg_is_from() and smb_addpollclosure().
      5ea459df
  26. 04 Dec, 2015 1 commit