dovecot: Don't crash when seeking to end of file.

dovecot at dovecot.org dovecot at dovecot.org
Mon Dec 3 12:13:53 EET 2007


details:   http://hg.dovecot.org/dovecot/rev/25ca7c443357
changeset: 6907:25ca7c443357
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Dec 03 12:13:49 2007 +0200
description:
Don't crash when seeking to end of file.

diffstat:

1 file changed, 5 insertions(+), 2 deletions(-)
src/lib/istream-concat.c |    7 +++++--

diffs (25 lines):

diff -r a201579e585d -r 25ca7c443357 src/lib/istream-concat.c
--- a/src/lib/istream-concat.c	Mon Dec 03 11:45:24 2007 +0200
+++ b/src/lib/istream-concat.c	Mon Dec 03 12:13:49 2007 +0200
@@ -88,8 +88,10 @@ static ssize_t i_stream_concat_read(stru
 	ssize_t ret;
 	bool last_stream;
 
-	if (cstream->cur_input == NULL)
+	if (cstream->cur_input == NULL) {
+		stream->istream.eof = TRUE;
 		return -1;
+	}
 
 	skip = stream->skip;
 	if (cstream->prev_size > 0) {
@@ -207,7 +209,8 @@ static void i_stream_concat_seek(struct 
 		return;
 	}
 	cstream->cur_input = cstream->input[cstream->cur_idx];
-	i_stream_seek(cstream->cur_input, v_offset);
+	if (cstream->cur_input != NULL)
+		i_stream_seek(cstream->cur_input, v_offset);
 }
 
 static const struct stat *


More information about the dovecot-cvs mailing list