From 32b604e8c720fc30398e7bf255fc75cfe22825dd Mon Sep 17 00:00:00 2001 From: Philippe Antoine Date: Fri, 5 Feb 2021 15:15:27 +0100 Subject: [PATCH] template: use response_gap in rust parser --- rust/src/applayertemplate/template.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/rust/src/applayertemplate/template.rs b/rust/src/applayertemplate/template.rs index 99d9343eb9..feabfc6568 100644 --- a/rust/src/applayertemplate/template.rs +++ b/rust/src/applayertemplate/template.rs @@ -177,6 +177,17 @@ impl TemplateState { return AppLayerResult::ok(); } + if self.response_gap { + if probe(input).is_err() { + // The parser now needs to decide what to do as we are not in sync. + // For this template, we'll just try again next time. + return AppLayerResult::ok(); + } + + // It looks like we're in sync with a message header, clear gap + // state and keep parsing. + self.response_gap = false; + } let mut start = input; while start.len() > 0 { match parser::parse_message(start) { -- 2.47.2