[dovecot-cvs] dovecot/src/lib-storage/index/mbox istream-raw-mbox.c, 1.22, 1.23

cras at dovecot.org cras at dovecot.org
Mon Aug 23 10:01:51 EEST 2004


Update of /home/cvs/dovecot/src/lib-storage/index/mbox
In directory talvi:/tmp/cvs-serv5861/lib-storage/index/mbox

Modified Files:
	istream-raw-mbox.c 
Log Message:
Don't crash with empty body



Index: istream-raw-mbox.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/mbox/istream-raw-mbox.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- istream-raw-mbox.c	23 Aug 2004 04:04:24 -0000	1.22
+++ istream-raw-mbox.c	23 Aug 2004 07:01:49 -0000	1.23
@@ -248,15 +248,16 @@
 		new_pos = i - (fromp - mbox_from);
 	}
 
-	if (new_pos == stream->pos)
-		ret = stream->istream.eof ? -1 : -2;
-	else {
+	stream->buffer = buf;
+	if (new_pos == stream->pos) {
+		if (stream->istream.eof)
+			return _read(stream);
+		ret = -2;
+	} else {
 		i_assert(new_pos > stream->pos);
 		ret = new_pos - stream->pos;
 		stream->pos = new_pos;
 	}
-
-	stream->buffer = buf;
 	return ret;
 }
 



More information about the dovecot-cvs mailing list