changeset 20535:82f11b614b99

Calling i_stream_next_line() on a chain stream would sometimes erroneously use the stream->w_buffer. It used the wrong check to assess whether the w_buffer is usable. The chain stream only uses the w_buffer when partial stream data needs to be merged. Otherwise, a parent stream's buffer is used directly. However, this does not mean that w_buffer will be NULL in that case, which is what i_stream_next_line() assumed.
author Stephan Bosch <stephan@dovecot.fi>
date Wed, 13 Jul 2016 09:46:08 +0200
parents cffb60b15b6e
children f0e431db73d8
files src/lib/istream.c
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/istream.c	Mon Jul 11 20:27:48 2016 +0300
+++ b/src/lib/istream.c	Wed Jul 13 09:46:08 2016 +0200
@@ -386,7 +386,7 @@
 		stream->line_crlf = FALSE;
 	}
 
-	if (stream->w_buffer != NULL) {
+	if (stream->buffer == stream->w_buffer) {
 		/* modify the buffer directly */
 		stream->w_buffer[end] = '\0';
 		ret = (char *)stream->w_buffer + stream->skip;