Skip to content

Commit

Permalink
imap: Fixed potential crash when logging about pending commands at lo…
Browse files Browse the repository at this point in the history
…gout.
  • Loading branch information
sirainen committed Dec 16, 2015
1 parent 3bc62ef commit c8e9fa2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/imap/imap-client.c
Expand Up @@ -279,6 +279,11 @@ static const char *client_get_commands_status(struct client *client)
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, ',');
Expand All @@ -287,6 +292,8 @@ static const char *client_get_commands_status(struct client *client)
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))
Expand Down

0 comments on commit c8e9fa2

Please sign in to comment.