]> 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)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 22 Dec 2017 13:33:29 +0000 (15:33 +0200)
src/lib/istream-multiplex.c

index 9c927406fd3dcfe92cea2a24af19d869d154f4c8..0f86df7abeb5b216f791a90968f11d8125a916c5 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);
                }
        }
 }