Commit Graph

37 Commits (master)

Author SHA1 Message Date
Leah Neukirchen 1838158ef1 blaze822_priv.h: use proper lc/uc
Mail headers may contain characters where the simple definition breaks,
which results in wrong formatting on output.

Fixes #235.
1 year ago
Leah Neukirchen b962fb6be0 rfc2047: skip whitespace everywhere during base64 decoding
> The encoded output stream must be represented in lines of no more
> than 76 characters each.  All line breaks or other characters not
> found in Table 1 must be ignored by decoding software.  In base64
> data, characters other than those in Table 1, line breaks, and other
> white space probably indicate a transmission error, about which a
> warning message or even a message rejection might be appropriate
> under some circumstances.
3 years ago
Leah Neukirchen 023c26f943 rfc2047: blaze822_decode_rfc2047: account for space for trailing nul 5 years ago
Leah Neukirchen 3c3c175086 rfc2047: blaze822_decode_rfc2047: fix memory leak of srcenc 6 years ago
Leah Neukirchen 4fef01ab6d rfc2047: blaze822_decode_rfc2047: check for NUL bytes at the very end of decoding 7 years ago
Leah Neukirchen ba4a0cf589 rfc2047: blaze822_decode_rfc2047: don't decode encoded-words that contain NUL bytes
This is a lax interpretation of RFC 2047, 4.5:
> Only printable and white space character data should be encoded using
> this scheme.  However, since these encoding schemes allow the
> encoding of arbitrary octet values, mail readers that implement this
> decoding should also ensure that display of the decoded data on the
> recipient's terminal will not cause unwanted side-effects.

Since many of the code that deals with header values does not support
inline NUL bytes, it's best to not decode them here.
We check for this after iconv, so quoted-printable UTF-32 e.g. should be
safe.

Also see https://www.mailsploit.com/
7 years ago
Leah Neukirchen e6239ef353 rfc2047: blaze822_decide_rfc2047: ensure enough space for NUL-termination
Closes #76.
7 years ago
Leah Neukirchen 5f45b7d533 use appropriate integer types
Mainly found with clang -Wconversion -Wshorten-64-to-32.
7 years ago
Leah Neukirchen 5ff71ace36 rfc2047: blaze822_decode_qp: decode invalid qp-codes as literal 7 years ago
Leah Neukirchen 66d0eff12f style 7 years ago
Leah Neukirchen 3b51c5938a rfc2047: blaze822_decode_b64: ensure nul-termination of result
Fixes #70.
7 years ago
Leah Neukirchen 36faf7f114 rfc2047: blaze822_decode_rfc2047: ignore RFC 2231 language tag 7 years ago
Christian Neukirchen 40b19264c5 rfc2047: only decode _ as spaces when decoding headers 8 years ago
Christian Neukirchen b336acc23c rfc2047: blaze822_decode_qp: don't waste 75% memory 8 years ago
Christian Neukirchen 27915af60d rfc2047: detect partial multibyte sequences and decode them correctly 8 years ago
Christian Neukirchen a1ed8d7b6c rfc2047: blaze822_decode_qp: skip =CRLF 8 years ago
Christian Neukirchen 525233811c rfc2047: allow empty encoded-words
This is non-conforming, but happens in the wild occasionally.
8 years ago
Christian Neukirchen a82cb18ccc rfc2047: blaze822_decode_rfc2047: initialize dec and decchunk.
Found by clang-analyzer.
8 years ago
Christian Neukirchen 22f456a2a0 clean up header includes 8 years ago
Christian Neukirchen 54b93c8f63 rfc2047: decode ??? on errors 8 years ago
Christian Neukirchen 8629e12ee6 rfc2047: revert in blaze822_decode_b64 8 years ago
Christian Neukirchen 010458d971 rfc2047: try sliced version of blaze822_decode_b64 (no benefit in practise) 8 years ago
Christian Neukirchen 00b0e23f1f rfc2047: blaze822_decode_b64: check bounds 8 years ago
Christian Neukirchen 1a1f01ecf9 rfc2047: blaze822_decode_qp: check bounds 8 years ago
Christian Neukirchen 11c9ce78f1 rfc2047: blaze822_decode_qp: off-by-one in qp decoding 8 years ago
Christian Neukirchen 6e6d1993a2 rfc2047: free all things in blaze822_decode_rfc2047 8 years ago
Christian Neukirchen b32ef0fd5a blaze822_priv.h: add isfws 8 years ago
Christian Neukirchen 8ba55bae99 blaze822_priv.h: macro cleanup 8 years ago
Christian Neukirchen 17355dbe63 blaze822: api refactoring 8 years ago
Christian Neukirchen 9b2a97416d rfc2047: detect iconv_open error properly 8 years ago
Christian Neukirchen 56a30a4068 rfc2047: suppress common error messages 8 years ago
Christian Neukirchen 3d40dedd96 rfc2047: consistency 8 years ago
Christian Neukirchen 4bd036232d rfc2047: better base64 memory bound 8 years ago
Christian Neukirchen bd1ab50db8 rfc2047: avoid tolower 8 years ago
Christian Neukirchen cd510df51d rfc2047: handle uint properly 8 years ago
Christian Neukirchen 3ce49fb460 fix unsigned computation 8 years ago
Christian Neukirchen 3bb5452964 add rfc2047 decoder 8 years ago