Mercurial > dovecot > original-hg > dovecot-1.2
changeset 5111:daf87522bce4 HEAD
Fixes
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 06 Feb 2007 15:24:42 +0200 |
parents | ce804b173797 |
children | c72eb76e4173 |
files | src/lib-mail/message-parser.c |
diffstat | 1 files changed, 14 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-mail/message-parser.c Tue Feb 06 14:56:12 2007 +0200 +++ b/src/lib-mail/message-parser.c Tue Feb 06 15:24:42 2007 +0200 @@ -243,6 +243,8 @@ struct message_boundary *boundary, struct message_block *block_r) { + struct message_part *part; + if (boundary == NULL) { /* message ended unexpectedly */ return -1; @@ -250,13 +252,11 @@ /* get back to parent MIME part, summing the child MIME part sizes into parent's body sizes */ - while (boundary->part != ctx->part) { - message_size_add(&ctx->part->parent->body_size, - &ctx->part->body_size); - message_size_add(&ctx->part->parent->body_size, - &ctx->part->header_size); - ctx->part = ctx->part->parent; + for (part = ctx->part; part != boundary->part; part = part->parent) { + message_size_add(&part->parent->body_size, &part->body_size); + message_size_add(&part->parent->body_size, &part->header_size); } + ctx->part = part; if (boundary->epilogue_found) { /* this boundary isn't needed anymore */ @@ -332,10 +332,15 @@ } } - if (i == block_r->size) { + if (i >= block_r->size) { /* the boundary wasn't found from this data block, we'll need more data. */ - ret = eof ? -1 : 0; + if (eof) + ret = -1; + else { + ret = 0; + ctx->want_count = i + 1; + } } i_assert(!(ret == 0 && full)); @@ -569,6 +574,7 @@ block_r->part = ctx->part; if (ret < 0) { + i_assert(ctx->input->eof); while (ctx->part->parent != NULL) { message_size_add(&ctx->part->parent->body_size, &ctx->part->body_size);