]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
smtp: check if we have a current transaction
authorPhilippe Antoine <contact@catenacyber.fr>
Tue, 25 Jan 2022 20:10:37 +0000 (21:10 +0100)
committerVictor Julien <vjulien@oisf.net>
Thu, 7 Apr 2022 06:40:28 +0000 (08:40 +0200)
Ticket: 4948

This is not the perfect solution, but it prevents to trigger
the assert, and keep the assert.
A better solution would need to create transaction from
the reponse parsing, in case a later command was buffered and
not answered. But this would not be enough as NoNewTx prevents
the creation of a new transaction for RSET...

(cherry picked from commit 4247605d874113ef13003816007e0575219d065e)

src/app-layer-smtp.c

index 87809db24d9302b98e4a80f23deec92e0321714d..09e01b0b5d75c86deddf8e615ab94ab25210750d 100644 (file)
@@ -1059,7 +1059,7 @@ static int SMTPProcessReply(SMTPState *state, Flow *f,
             SMTPSetEvent(state, SMTP_DECODER_EVENT_DATA_COMMAND_REJECTED);
         }
     } else if (IsReplyToCommand(state, SMTP_COMMAND_RSET)) {
-        if (reply_code == SMTP_REPLY_250 &&
+        if (reply_code == SMTP_REPLY_250 && state->curr_tx &&
                 !(state->parser_state & SMTP_PARSER_STATE_PARSING_MULTILINE_REPLY)) {
             SMTPTransactionComplete(state);
         }