Mercurial > dovecot > core-2.2
changeset 16519:9dcbcc0871f0
istream-attachment-extractor: Fixed handling attachment as the message body without MIME.
Don't crash at the end after parsing the base64 data.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 16 Jun 2013 21:08:40 +0300 |
parents | c290383e60da |
children | dd04b4ef530d |
files | src/lib-mail/istream-attachment-extractor.c |
diffstat | 1 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-mail/istream-attachment-extractor.c Sun Jun 16 20:15:42 2013 +0300 +++ b/src/lib-mail/istream-attachment-extractor.c Sun Jun 16 21:08:40 2013 +0300 @@ -524,6 +524,7 @@ astream_end_of_part(struct attachment_istream *astream) { struct attachment_istream_part *part = &astream->part; + size_t old_size; int ret = 0; /* MIME part changed. we're now parsing the end of a boundary, @@ -540,8 +541,15 @@ } break; case MAIL_ATTACHMENT_STATE_YES: + old_size = astream->istream.pos - astream->istream.skip; if (astream_part_finish(astream) < 0) ret = -1; + else { + /* finished base64 may have added a few more trailing + bytes to the stream */ + ret = astream->istream.pos - + astream->istream.skip - old_size; + } break; } part->state = MAIL_ATTACHMENT_STATE_NO;