changeset 6907:25ca7c443357 HEAD

Don't crash when seeking to end of file.
author Timo Sirainen <tss@iki.fi>
date Mon, 03 Dec 2007 12:13:49 +0200
parents a201579e585d
children a340d3379b90
files src/lib/istream-concat.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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 @@
 	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 @@
 		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 *