smtp: don't read uninitialized value

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.
pull/850/head
Victor Julien 11 years ago
parent 0416a8428d
commit 95fa5ae1d2

@ -570,7 +570,9 @@ static int SMTPProcessReply(SMTPState *state, Flow *f,
}
}
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;

Loading…
Cancel
Save