summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2018-08-25 19:48:23 +0300
committerSergey Poznyakoff <gray@gnu.org>2018-08-25 19:48:23 +0300
commit4a9746cc2ff998a5c52a5fb24c9aea3a851b1ea1 (patch)
tree2583fd19ccdd60bb09838419f13150d768f928d9
parent13ddc9049ba934ef57184a655aaa42c095b7dca4 (diff)
downloadmailutils-4a9746cc2ff998a5c52a5fb24c9aea3a851b1ea1.tar.gz
mailutils-4a9746cc2ff998a5c52a5fb24c9aea3a851b1ea1.tar.bz2
Bugfix in base64 encoder
* libmailutils/filter/base64.c (_base64_encoder): Don't return immediately on eof. The encoder can have some more characters for output, left over from the previous call.
-rw-r--r--libmailutils/filter/base64.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/libmailutils/filter/base64.c b/libmailutils/filter/base64.c
index ec48ead02..b080319e4 100644
--- a/libmailutils/filter/base64.c
+++ b/libmailutils/filter/base64.c
@@ -233,14 +233,19 @@ _base64_encoder (void *xd,
break;
}
+ if (iobuf->osize < 4)
+ {
+ iobuf->osize = 4;
+ return mu_filter_moreoutput;
+ }
+
if (iobuf->isize == 0)
{
- iobuf->osize = 0;
iobuf->eof = 1;
- return mu_filter_ok;
+ /* continue to the loop; this is necessary if the encoder is in
+ base64_newline or base64_rollback state */
}
-
- if (iobuf->isize <= 3)
+ else if (iobuf->isize <= 3)
{
if (cmd == mu_filter_lastbuf)
pad = 1;
@@ -250,11 +255,6 @@ _base64_encoder (void *xd,
return mu_filter_moreinput;
}
}
- if (iobuf->osize < 4)
- {
- iobuf->osize = 4;
- return mu_filter_moreoutput;
- }
ptr = (const unsigned char*) iobuf->input;
isize = iobuf->isize;

Return to:

Send suggestions and report system problems to the System administrator.