Commit Graph

34 Commits

Author SHA1 Message Date
Leah Neukirchen
3c3c175086 rfc2047: blaze822_decode_rfc2047: fix memory leak of srcenc 2018-01-11 15:39:07 +01:00
Leah Neukirchen
4fef01ab6d rfc2047: blaze822_decode_rfc2047: check for NUL bytes at the very end of decoding 2017-12-05 18:05:58 +01:00
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/
2017-12-05 16:59:31 +01:00
Leah Neukirchen
e6239ef353 rfc2047: blaze822_decide_rfc2047: ensure enough space for NUL-termination
Closes #76.
2017-11-11 16:57:52 +01:00
Leah Neukirchen
5f45b7d533 use appropriate integer types
Mainly found with clang -Wconversion -Wshorten-64-to-32.
2017-10-06 13:15:28 +02:00
Leah Neukirchen
5ff71ace36 rfc2047: blaze822_decode_qp: decode invalid qp-codes as literal 2017-09-27 14:42:54 +02:00
Leah Neukirchen
66d0eff12f style 2017-08-31 17:30:17 +02:00
Leah Neukirchen
3b51c5938a rfc2047: blaze822_decode_b64: ensure nul-termination of result
Fixes #70.
2017-07-30 16:44:16 +02:00
Leah Neukirchen
36faf7f114 rfc2047: blaze822_decode_rfc2047: ignore RFC 2231 language tag 2017-04-06 22:55:00 +02:00
Christian Neukirchen
40b19264c5 rfc2047: only decode _ as spaces when decoding headers 2016-11-08 16:19:26 +01:00
Christian Neukirchen
b336acc23c rfc2047: blaze822_decode_qp: don't waste 75% memory 2016-11-02 13:37:22 +01:00
Christian Neukirchen
27915af60d rfc2047: detect partial multibyte sequences and decode them correctly 2016-10-14 22:20:11 +02:00
Christian Neukirchen
a1ed8d7b6c rfc2047: blaze822_decode_qp: skip =CRLF 2016-07-29 13:58:11 +02:00
Christian Neukirchen
525233811c rfc2047: allow empty encoded-words
This is non-conforming, but happens in the wild occasionally.
2016-07-29 12:54:03 +02:00
Christian Neukirchen
a82cb18ccc rfc2047: blaze822_decode_rfc2047: initialize dec and decchunk.
Found by clang-analyzer.
2016-07-21 20:16:10 +02:00
Christian Neukirchen
22f456a2a0 clean up header includes 2016-07-18 17:06:41 +02:00
Christian Neukirchen
54b93c8f63 rfc2047: decode ??? on errors 2016-07-15 16:51:17 +02:00
Christian Neukirchen
8629e12ee6 rfc2047: revert in blaze822_decode_b64 2016-07-15 16:39:23 +02:00
Christian Neukirchen
010458d971 rfc2047: try sliced version of blaze822_decode_b64 (no benefit in practise) 2016-07-15 16:38:48 +02:00
Christian Neukirchen
00b0e23f1f rfc2047: blaze822_decode_b64: check bounds 2016-07-14 18:24:08 +02:00
Christian Neukirchen
1a1f01ecf9 rfc2047: blaze822_decode_qp: check bounds 2016-07-14 17:43:09 +02:00
Christian Neukirchen
11c9ce78f1 rfc2047: blaze822_decode_qp: off-by-one in qp decoding 2016-07-13 20:53:26 +02:00
Christian Neukirchen
6e6d1993a2 rfc2047: free all things in blaze822_decode_rfc2047 2016-07-13 17:17:43 +02:00
Christian Neukirchen
b32ef0fd5a blaze822_priv.h: add isfws 2016-07-13 16:00:20 +02:00
Christian Neukirchen
8ba55bae99 blaze822_priv.h: macro cleanup 2016-07-13 15:56:50 +02:00
Christian Neukirchen
17355dbe63 blaze822: api refactoring 2016-07-13 15:52:39 +02:00
Christian Neukirchen
9b2a97416d rfc2047: detect iconv_open error properly 2016-07-12 16:23:51 +02:00
Christian Neukirchen
56a30a4068 rfc2047: suppress common error messages 2016-07-12 16:15:22 +02:00
Christian Neukirchen
3d40dedd96 rfc2047: consistency 2016-07-12 16:15:00 +02:00
Christian Neukirchen
4bd036232d rfc2047: better base64 memory bound 2016-07-12 16:12:44 +02:00
Christian Neukirchen
bd1ab50db8 rfc2047: avoid tolower 2016-07-12 15:16:56 +02:00
Christian Neukirchen
cd510df51d rfc2047: handle uint properly 2016-07-12 14:08:31 +02:00
Christian Neukirchen
3ce49fb460 fix unsigned computation 2016-07-12 13:37:51 +02:00
Christian Neukirchen
3bb5452964 add rfc2047 decoder 2016-07-11 23:40:00 +02:00