Mercurial > dovecot > core-2.2
changeset 22718:687aec32e0e5
doveadm: Fix potential crash or reading garbage from doveadm-server
The connection's input buffer may have been reallocated or otherwise moved
while checking for log input.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Fri, 22 Dec 2017 15:07:28 +0200 |
parents | e33ad4efec00 |
children | b35916412f38 |
files | src/doveadm/server-connection.c |
diffstat | 1 files changed, 5 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/doveadm/server-connection.c Wed Aug 09 13:17:15 2017 +0300 +++ b/src/doveadm/server-connection.c Fri Dec 22 15:07:28 2017 +0200 @@ -397,14 +397,15 @@ const char *line; int exit_code; + /* check logs - NOTE: must be before i_stream_get_data() since checking + for logs may add data to our channel. */ + if (conn->log_input != NULL) + (void)server_connection_print_log(conn); + data = i_stream_get_data(conn->input, &size); if (size == 0) return FALSE; - /* check logs */ - if (conn->log_input != NULL) - (void)server_connection_print_log(conn); - switch (conn->state) { case SERVER_REPLY_STATE_DONE: i_error("doveadm server sent unexpected input");