diff options
Diffstat (limited to 'libmailutils/filter/qpflt.c')
-rw-r--r-- | libmailutils/filter/qpflt.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/libmailutils/filter/qpflt.c b/libmailutils/filter/qpflt.c index 569dc609f..06ed1c7a8 100644 --- a/libmailutils/filter/qpflt.c +++ b/libmailutils/filter/qpflt.c @@ -1,5 +1,5 @@ /* GNU Mailutils -- a suite of utilities for electronic mail - Copyright (C) 2009-2019 Free Software Foundation, Inc. + Copyright (C) 2009-2024 Free Software Foundation, Inc. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -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 += 2; + } + 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 += 3; + } else { /* you get =XX where XX are hex characters. */ @@ -238,7 +251,7 @@ _qp_encoder (void *xd, nbytes += 3; - /* we've actuall used up one byte of input */ + /* we've actually used up one byte of input */ iptr++; consumed++; } |