dovecot-2.1: imapc: Don't crash if we receive tagged BAD reply.

dovecot at dovecot.org dovecot at dovecot.org
Mon Dec 12 08:44:15 EET 2011


details:   http://hg.dovecot.org/dovecot-2.1/rev/6c1080148739
changeset: 13853:6c1080148739
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Dec 12 08:36:25 2011 +0200
description:
imapc: Don't crash if we receive tagged BAD reply.

diffstat:

 src/lib-imap-client/imapc-connection.c |  8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diffs (31 lines):

diff -r 8dc4ffcc3b83 -r 6c1080148739 src/lib-imap-client/imapc-connection.c
--- a/src/lib-imap-client/imapc-connection.c	Mon Dec 12 08:29:50 2011 +0200
+++ b/src/lib-imap-client/imapc-connection.c	Mon Dec 12 08:36:25 2011 +0200
@@ -951,12 +951,13 @@
 	unsigned int i, count;
 	char *line, *linep;
 	const char *p;
-	struct imap_parser *parser;
 	struct imapc_command_reply reply;
 
 	line = i_stream_next_line(conn->input);
 	if (line == NULL)
 		return 0;
+	/* make sure reply texts stays valid if input stream gets freed */
+	line = t_strdup_noconst(line);
 
 	memset(&reply, 0, sizeof(reply));
 
@@ -1033,12 +1034,7 @@
 	}
 
 	imapc_connection_input_reset(conn);
-
-	parser = conn->parser;
-	imap_parser_ref(parser);
 	imapc_command_reply_free(cmd, &reply);
-	imap_parser_unref(&parser);
-
 	imapc_command_send_more(conn);
 	return 1;
 }


More information about the dovecot-cvs mailing list