Skip to content

Commit

Permalink
lib-smtp: smtp-server-command - Fix segfault occurring in smtp_server…
Browse files Browse the repository at this point in the history
…_command_get_reply().

Can occur when not all replies are submitted yet.
  • Loading branch information
stephanbosch committed Mar 18, 2019
1 parent 6bdeddc commit 7d3ddff
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lib-smtp/smtp-server-command.c
Expand Up @@ -609,10 +609,12 @@ smtp_server_command_get_reply(struct smtp_server_command *cmd,
{
struct smtp_server_reply *reply;

i_assert(idx < cmd->replies_expected);

if (!array_is_created(&cmd->replies))
return NULL;

reply = array_idx_modifiable(&cmd->replies, idx);
reply = array_idx_get_space(&cmd->replies, idx);
if (!reply->submitted)
return NULL;
return reply;
Expand Down

0 comments on commit 7d3ddff

Please sign in to comment.