From b4796b3100ce0c93f43060c42f314445442c9d0e Mon Sep 17 00:00:00 2001 From: Stephan Bosch Date: Wed, 13 Jul 2016 09:46:08 +0200 Subject: [PATCH] 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. --- src/lib/istream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/istream.c b/src/lib/istream.c index aa95c1cb9d..3f914f5515 100644 --- a/src/lib/istream.c +++ b/src/lib/istream.c @@ -386,7 +386,7 @@ static char *i_stream_next_line_finish(struct istream_private *stream, size_t i) 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; -- 2.47.3