dovecot-2.2: imap: Don't hang with zero size CATENATE TEXT parts.
dovecot at dovecot.org
dovecot at dovecot.org
Wed Aug 29 23:16:12 EEST 2012
details: http://hg.dovecot.org/dovecot-2.2/rev/c9dbd649a78e
changeset: 14983:c9dbd649a78e
user: Timo Sirainen <tss at iki.fi>
date: Wed Aug 29 23:15:56 2012 +0300
description:
imap: Don't hang with zero size CATENATE TEXT parts.
diffstat:
src/imap/cmd-append.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diffs (24 lines):
diff -r 6c0ba0348e85 -r c9dbd649a78e src/imap/cmd-append.c
--- a/src/imap/cmd-append.c Wed Aug 29 23:13:56 2012 +0300
+++ b/src/imap/cmd-append.c Wed Aug 29 23:15:56 2012 +0300
@@ -241,9 +241,17 @@
/* save the mail */
ctx->cat_msg_size += ctx->literal_size;
- ctx->litinput = i_stream_create_limit(cmd->client->input,
- ctx->literal_size);
- i_stream_chain_append(ctx->catchain, ctx->litinput);
+ if (ctx->literal_size == 0) {
+ /* zero length literal. RFC doesn't explicitly specify
+ what should be done with this, so we'll simply
+ handle it by skipping the empty text part. */
+ ctx->litinput = i_stream_create_from_data("", 0);
+ ctx->litinput->eof = TRUE;
+ } else {
+ ctx->litinput = i_stream_create_limit(cmd->client->input,
+ ctx->literal_size);
+ i_stream_chain_append(ctx->catchain, ctx->litinput);
+ }
}
static int
More information about the dovecot-cvs
mailing list