]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: istream-multiplex - Return error if the last packet wasn't fully read
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 22 Dec 2017 13:10:00 +0000 (15:10 +0200)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Wed, 3 Jan 2018 10:40:29 +0000 (12:40 +0200)
src/lib/istream-multiplex.c

index acc76024a92a9b4d5dcc832cc620dcb7cb87bffd..1298ed9ecbd00eab04db1f7dbc4810615ab1ca40 100644 (file)
@@ -56,8 +56,15 @@ static void propagate_eof(struct multiplex_istream *mstream)
 {
        struct multiplex_ichannel **channelp;
        array_foreach_modifiable(&mstream->channels, channelp) {
-               if (*channelp != NULL) {
-                       (*channelp)->istream.istream.eof = TRUE;
+               if (*channelp == NULL)
+                       continue;
+
+               (*channelp)->istream.istream.eof = TRUE;
+               if (mstream->remain > 0) {
+                       (*channelp)->istream.istream.stream_errno = EPIPE;
+                       io_stream_set_error(&(*channelp)->istream.iostream,
+                               "Unexpected EOF - %u bytes remaining in packet",
+                               mstream->remain);
                }
        }
 }