changeset 20812:d2969430234a

lib-test: Fix illegal memory access in test-ostream
author Aki Tuomi <aki.tuomi@dovecot.fi>
date Mon, 03 Oct 2016 10:08:31 +0300
parents 1bd9c2258fd9
children 6e6163782590
files src/lib-test/test-ostream.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-test/test-ostream.c	Mon Oct 03 09:11:23 2016 +0300
+++ b/src/lib-test/test-ostream.c	Mon Oct 03 10:08:31 2016 +0300
@@ -82,7 +82,8 @@
 		ret += n;
 		if (n != cur_iov.iov_len)
 			break;
-		cur_iov = iov[++i];
+		if (++i < iov_count)
+			cur_iov = iov[i];
 	} while (i < iov_count);
 
 	tstream->flush_pending = TRUE;