changeset 5411:bea1e1bab54a HEAD

Fixes
author Timo Sirainen <tss@iki.fi>
date Sun, 25 Mar 2007 21:27:16 +0300
parents 73032525bca0
children 79187982328f
files src/lib-mail/message-parser.c
diffstat 1 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-mail/message-parser.c	Sun Mar 25 21:26:53 2007 +0300
+++ b/src/lib-mail/message-parser.c	Sun Mar 25 21:27:16 2007 +0300
@@ -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;
 		}
 	}