[dovecot-cvs] dovecot/src/lib-mail message-parser.c,1.60,1.61

cras at dovecot.org cras at dovecot.org
Tue Sep 7 17:23:27 EEST 2004


Update of /var/lib/cvs/dovecot/src/lib-mail
In directory talvi:/tmp/cvs-serv18630

Modified Files:
	message-parser.c 
Log Message:
Fixes for handling headers longer than input buffer.



Index: message-parser.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-mail/message-parser.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- message-parser.c	23 Aug 2004 04:05:26 -0000	1.60
+++ message-parser.c	7 Sep 2004 14:23:25 -0000	1.61
@@ -759,16 +759,20 @@
 
 			/* a) line is larger than input buffer
 			   b) header ended unexpectedly */
-			if (colon_pos == UINT_MAX && ret == -2) {
+			if (colon_pos == UINT_MAX && ret == -2 &&
+			    !line->continues) {
 				/* header name is huge. just skip it. */
 				message_skip_line(ctx->input, ctx->hdr_size,
 						  TRUE, &ctx->has_nuls);
+				startpos = 0;
 				continue;
 			}
 
 			if (ret == -2) {
 				/* go back to last LWSP if found. */
-				for (i = size-1; i > colon_pos; i--) {
+				size_t min_pos =
+					!line->continues ? colon_pos : 0;
+				for (i = size-1; i > min_pos; i--) {
 					if (IS_LWSP(msg[i])) {
 						size = i;
 						break;



More information about the dovecot-cvs mailing list