dovecot: Assert-crashfix when header line was longer than our in...

dovecot at dovecot.org dovecot at dovecot.org
Fri Feb 8 08:46:12 EET 2008


details:   http://hg.dovecot.org/dovecot/rev/4674cdad3672
changeset: 7217:4674cdad3672
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Feb 08 08:46:08 2008 +0200
description:
Assert-crashfix when header line was longer than our input buffer and
MESSAGE_HEADER_PARSER_FLAG_CLEAN_ONELINE was used.

diffstat:

1 file changed, 8 insertions(+), 5 deletions(-)
src/lib-mail/message-header-parser.c |   13 ++++++++-----

diffs (28 lines):

diff -r 56f8ac7a3a77 -r 4674cdad3672 src/lib-mail/message-header-parser.c
--- a/src/lib-mail/message-header-parser.c	Wed Feb 06 19:02:25 2008 +0200
+++ b/src/lib-mail/message-header-parser.c	Fri Feb 08 08:46:08 2008 +0200
@@ -339,16 +339,19 @@ int message_parse_header_next(struct mes
 		line->full_value = line->value;
 		line->full_value_len = line->value_len;
 	} else if (line->use_full_value) {
-		/* continue saving the full value */
-		if (!last_no_newline) {
+		/* continue saving the full value. */
+		if (last_no_newline) {
+			/* line is longer than fit into our buffer, so we
+			   were forced to break it into multiple
+			   message_header_lines */
+		} else {
 			if (last_crlf)
 				buffer_append_c(ctx->value_buf, '\r');
 			buffer_append_c(ctx->value_buf, '\n');
 		}
 		if ((ctx->flags & MESSAGE_HEADER_PARSER_FLAG_CLEAN_ONELINE) &&
-		    line->value_len > 0 && line->value[0] != ' ') {
-			i_assert(IS_LWSP(line->value[0]));
-
+		    line->value_len > 0 && line->value[0] != ' ' &&
+		    IS_LWSP(line->value[0])) {
 			buffer_append_c(ctx->value_buf, ' ');
 			buffer_append(ctx->value_buf,
 				      line->value + 1, line->value_len - 1);


More information about the dovecot-cvs mailing list