]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Calling i_stream_next_line() on a chain stream would sometimes erroneously use the...
authorStephan Bosch <stephan@dovecot.fi>
Wed, 13 Jul 2016 07:46:08 +0000 (09:46 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 4 Aug 2016 15:07:30 +0000 (18:07 +0300)
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

index aa95c1cb9d7d06dcef894a799c18a184ce5a4c82..3f914f551564f226d3a374b13e15935acbf19323 100644 (file)
@@ -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;