[dovecot-cvs] dovecot/src/lib ostream-file.c,1.42,1.43

cras at dovecot.org cras at dovecot.org
Thu Dec 16 22:41:18 EET 2004


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

Modified Files:
	ostream-file.c 
Log Message:
o_stream_send_istream() was broken and could have just caused copying to be
done infinitely filling up disk.



Index: ostream-file.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/ostream-file.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- ostream-file.c	16 Dec 2004 01:35:40 -0000	1.42
+++ ostream-file.c	16 Dec 2004 20:41:15 -0000	1.43
@@ -541,8 +541,17 @@
 			}
 		}
 		outstream->ostream.offset += ret;
-		i_stream_skip(instream, ret - (pos == 1 ? 0 : iov[0].iov_len));
 
+		/* only the last iov is from input stream. skip others. */
+		for (pos = 0; pos < iov_len-1; pos++) {
+			if ((size_t)ret < iov[pos].iov_len)
+				break;
+			ret -= iov[pos].iov_len;
+		}
+		if (pos != iov_len-1)
+			break;
+
+		i_stream_skip(instream, ret);
 		if ((size_t)ret != iov[pos].iov_len)
 			break;
 



More information about the dovecot-cvs mailing list