# HG changeset patch # User Timo Sirainen # Date 1450259981 -7200 # Node ID d2ffe96b528685b9bed6a6ccb870e0f42f1c1ae0 # Parent c986b91115d7cbfd5af456cd8d588c74dc427e17 imap: Fixed potential crash when logging about pending commands at logout. diff -r c986b91115d7 -r d2ffe96b5286 src/imap/imap-client.c --- a/src/imap/imap-client.c Wed Dec 16 11:29:36 2015 +0200 +++ b/src/imap/imap-client.c Wed Dec 16 11:59:41 2015 +0200 @@ -279,6 +279,11 @@ str = t_str_new(128); str_append(str, " ("); for (cmd = client->command_queue; cmd != NULL; cmd = cmd->next) { + if (cmd->name == NULL) { + /* (parts of a) tag were received, but not yet + the command name */ + continue; + } str_append(str, cmd->name); if (cmd->next != NULL) str_append_c(str, ','); @@ -287,6 +292,8 @@ bytes_out += cmd->bytes_out; last_cmd = cmd; } + if (str_len(str) <= 2) + return ""; cond = io_loop_find_fd_conditions(current_ioloop, client->fd_out); if ((cond & (IO_READ | IO_WRITE)) == (IO_READ | IO_WRITE))