[dovecot-cvs] dovecot/src/lib-mail message-parser.c,1.82,1.83

tss at dovecot.org tss at dovecot.org
Sun Mar 25 21:27:18 EEST 2007


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

Modified Files:
	message-parser.c 
Log Message:
Fixes



Index: message-parser.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-mail/message-parser.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -d -r1.82 -r1.83
--- message-parser.c	14 Mar 2007 14:36:44 -0000	1.82
+++ message-parser.c	25 Mar 2007 18:27:16 -0000	1.83
@@ -319,24 +319,30 @@
 	}
 
 	for (i = boundary_start = 0; i < block_r->size; i++) {
+		/* skip to beginning of the next line. the first line was
+		   handled already. */
 		for (; i < block_r->size; i++) {
 			if (data[i] == '\n') {
 				boundary_start = i;
 				if (i > 0 && data[i-1] == '\r')
 					boundary_start--;
+				i++;
 				break;
 			}
 		}
-		if (boundary_start != 0)
+		if (boundary_start != 0) {
+			/* we can skip the first lines. input buffer can't be
+			   full anymore. */
 			full = FALSE;
+		}
 
-		ret = boundary_line_find(ctx, block_r->data + i + 1,
-					 block_r->size - (i + 1), full,
+		ret = boundary_line_find(ctx, block_r->data + i,
+					 block_r->size - i, full,
 					 &boundary);
 		if (ret >= 0) {
 			/* found / need more data */
 			if (ret == 0 && boundary_start == 0)
-				ctx->want_count += i + 1;
+				ctx->want_count += i;
 			break;
 		}
 	}



More information about the dovecot-cvs mailing list