diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2021-07-19 11:32:31 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2021-07-19 11:32:31 +0300 |
commit | 3a9dd1123b71a7dcec93aae16e5da1beb6f41019 (patch) | |
tree | d8c9ce80669ad1f2e8c93644495a29fd4d6d08a3 | |
parent | 4befcfd015256c568121653038accbd84820198f (diff) | |
download | mailutils-3a9dd1123b71a7dcec93aae16e5da1beb6f41019.tar.gz mailutils-3a9dd1123b71a7dcec93aae16e5da1beb6f41019.tar.bz2 |
Fix in quoted-printable decoder
* libmailutils/filter/qpflt.c (_qp_decoder): Accept soft line breaks
(RFC 2045, 6.7, page 19)
-rw-r--r-- | libmailutils/filter/qpflt.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/libmailutils/filter/qpflt.c b/libmailutils/filter/qpflt.c index 08f6d3046..b1a177b37 100644 --- a/libmailutils/filter/qpflt.c +++ b/libmailutils/filter/qpflt.c @@ -84,7 +84,7 @@ _qp_decoder (void *xd, sz = osize - nbytes; else sz = wscount; - memcpy(optr, iptr - wscount - 1, sz); + memcpy (optr, iptr - wscount - 1, sz); optr += sz; nbytes += sz; if (wscount > sz) @@ -100,9 +100,22 @@ _qp_decoder (void *xd, if (c == '=') { - /* There must be 2 more characters before I consume this. */ - if (consumed + 2 >= isize) + if (consumed + 1 == isize) break; + + if (*iptr == '\n') + { + iptr++; + consumed++; + } + else if (consumed + 2 >= isize) + /* There must be 2 more characters before I consume this. */ + break; + else if (iptr[0] == '\r' && iptr[1] == '\n') + { + iptr += 2; + consumed += 2; + } else { /* you get =XX where XX are hex characters. */ |