From: Timo Sirainen Date: Wed, 24 Jan 2018 11:47:50 +0000 (+0200) Subject: lib: i_stream_read_more() - assert it can't return -2 X-Git-Tag: 2.3.9~2431 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=50977ed6891faabe013ffd1905667b91261c3eb9;p=thirdparty%2Fdovecot%2Fcore.git lib: i_stream_read_more() - assert it can't return -2 --- diff --git a/src/lib/istream.h b/src/lib/istream.h index 3c99bff641..caed38b03a 100644 --- a/src/lib/istream.h +++ b/src/lib/istream.h @@ -219,7 +219,9 @@ static inline int i_stream_read_more(struct istream *stream, const unsigned char **data_r, size_t *size_r) { - return i_stream_read_bytes(stream, data_r, size_r, 1); + int ret = i_stream_read_bytes(stream, data_r, size_r, 1); + i_assert(ret != -2); /* stream must have space for at least 1 byte */ + return ret; } /* Return the timestamp when istream last successfully read something. The timestamp is 0 if nothing has ever been read. */