dovecot-2.2: imap: Don't hang in APPEND when giving it invalid p...

dovecot at dovecot.org dovecot at dovecot.org
Mon May 6 19:51:28 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/ea0390e1789f
changeset: 16336:ea0390e1789f
user:      Timo Sirainen <tss at iki.fi>
date:      Mon May 06 19:49:18 2013 +0300
description:
imap: Don't hang in APPEND when giving it invalid parameters.

diffstat:

 src/imap/cmd-append.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (20 lines):

diff -r 67ec8bb5c27a -r ea0390e1789f src/imap/cmd-append.c
--- a/src/imap/cmd-append.c	Mon May 06 19:48:32 2013 +0300
+++ b/src/imap/cmd-append.c	Mon May 06 19:49:18 2013 +0300
@@ -708,12 +708,13 @@
 	/* parse the entire line up to the first message literal, or in case
 	   the input buffer is full of MULTIAPPEND CATENATE URLs, parse at
 	   least until the beginning of the next message */
-	arg_min_count = 1;
+	arg_min_count = 0;
 	do {
-		ret = imap_parser_read_args(ctx->save_parser, arg_min_count++,
+		ret = imap_parser_read_args(ctx->save_parser, ++arg_min_count,
 					    IMAP_PARSE_FLAG_LITERAL_SIZE |
 					    IMAP_PARSE_FLAG_LITERAL8, &args);
-	} while (ret > 0 && !cmd_append_args_can_stop(ctx, args));
+	} while (ret >= (int)arg_min_count &&
+		 !cmd_append_args_can_stop(ctx, args));
 	if (ret == -1) {
 		if (!ctx->failed) {
 			msg = imap_parser_get_error(ctx->save_parser, &fatal);


More information about the dovecot-cvs mailing list