dovecot: If FETCH failed internally, we could have sent broken o...

dovecot at dovecot.org dovecot at dovecot.org
Fri Aug 10 14:39:09 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/2618805b3d94
changeset: 6257:2618805b3d94
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Aug 10 14:30:03 2007 +0300
description:
If FETCH failed internally, we could have sent broken output (")" lines).

diffstat:

1 file changed, 3 insertions(+), 2 deletions(-)
src/imap/imap-fetch.c |    5 +++--

diffs (19 lines):

diff -r 0c9b6ff6fb0b -r 2618805b3d94 src/imap/imap-fetch.c
--- a/src/imap/imap-fetch.c	Thu Aug 09 22:25:14 2007 +0300
+++ b/src/imap/imap-fetch.c	Fri Aug 10 14:30:03 2007 +0300
@@ -367,12 +367,13 @@ int imap_fetch_deinit(struct imap_fetch_
 			handlers[i].handler(ctx, NULL, handlers[i].context);
 	}
 
-	str_free(&ctx->cur_str);
-
 	if (!ctx->line_finished) {
+		if (imap_fetch_flush_buffer(ctx) < 0)
+			return -1;
 		if (o_stream_send(ctx->client->output, ")\r\n", 3) < 0)
 			ctx->failed = TRUE;
 	}
+	str_free(&ctx->cur_str);
 
 	if (ctx->cur_input != NULL)
 		i_stream_unref(&ctx->cur_input);


More information about the dovecot-cvs mailing list