If a reply would be seen before a command, a read of a uninitialized
value could happen.
This patch adds a check for this.
Bug #1089.
}
}
- if (state->cmds[state->cmds_idx] == SMTP_COMMAND_STARTTLS) {
+ if (state->cmds_cnt == 0) {
+ /* reply but not a command we have stored, fall through */
+ } else if (state->cmds[state->cmds_idx] == SMTP_COMMAND_STARTTLS) {
if (reply_code == SMTP_REPLY_220) {
/* we are entering STARRTTLS data mode */
state->parser_state |= SMTP_PARSER_STATE_COMMAND_DATA_MODE;