[dovecot-cvs] dovecot/src/lib-mail message-parser.c,1.22,1.23

cras at procontrol.fi cras at procontrol.fi
Fri Oct 25 08:16:52 EEST 2002


Update of /home/cvs/dovecot/src/lib-mail
In directory danu:/tmp/cvs-serv2017

Modified Files:
	message-parser.c 
Log Message:
Header parser was still a bit wrong.



Index: message-parser.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-mail/message-parser.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- message-parser.c	25 Oct 2002 03:27:56 -0000	1.22
+++ message-parser.c	25 Oct 2002 04:16:50 -0000	1.23
@@ -328,13 +328,18 @@
 			continue;
 		}
 
-		if (ret < 0 || (ret == 0 && size == startpos)) {
-			/* EOF and nothing in buffer. the later check is
-			   needed only when there's no message body */
-			break;
+		if (size <= startpos) {
+			if (ret <= 0) {
+				/* EOF and nothing in buffer. the later check is
+				   needed only when there's no message body */
+				break;
+			}
+
+			parse_size = size;
+		} else {
+			parse_size = size-1;
 		}
 
-		parse_size = ret > 0 && size > 0 ? size-1 : size;
 		for (i = startpos; i < parse_size; i++) {
 			if (msg[i] == ':' && colon_pos == UINT_MAX) {
 				colon_pos = i;
@@ -400,7 +405,7 @@
 			}
 		}
 
-		if (i < size) {
+		if (i < parse_size) {
 			/* end of header */
 			startpos = i+1;
 			break;




More information about the dovecot-cvs mailing list