Skip to content

Commit

Permalink
imap: Fix potential hang when client sends too long line
Browse files Browse the repository at this point in the history
  • Loading branch information
sirainen authored and cmouse committed Oct 29, 2024
1 parent bfd7c60 commit 72a5ef3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/imap/imap-client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1190,6 +1190,13 @@ static bool client_skip_line(struct client *client)
}

i_stream_skip(client->input, i);
if (i > 0) {
/* We can be here if an earlier i_stream_read() has returned -2.
If there are multiple istreams layers, there might already
be input buffered in the istream. Make sure we finish
emptying the istream buffers so we don't hang. */
i_stream_set_input_pending(client->input, TRUE);
}
return !client->input_skip_line;
}

Expand Down

0 comments on commit 72a5ef3

Please sign in to comment.