From b9863d3e072a17d973c6c44154727121f90fc54f Mon Sep 17 00:00:00 2001 From: Juliana Fajardini Date: Tue, 30 Apr 2024 17:49:04 -0300 Subject: [PATCH] applayer/template: fix tx_id handling When we create a new transaction, we increment the State's tx_id and pass that to the tx.tx_id. so, when calling get_tx and free_tx, we shouldn't need to adjust the tx_id again. Related to Bug #7000 --- rust/src/applayertemplate/template.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust/src/applayertemplate/template.rs b/rust/src/applayertemplate/template.rs index e8cdc27dfe91..1bfd6b81c284 100644 --- a/rust/src/applayertemplate/template.rs +++ b/rust/src/applayertemplate/template.rs @@ -96,7 +96,7 @@ impl TemplateState { let mut index = 0; for i in 0..len { let tx = &self.transactions[i]; - if tx.tx_id == tx_id + 1 { + if tx.tx_id == tx_id { found = true; index = i; break; @@ -108,7 +108,7 @@ impl TemplateState { } pub fn get_tx(&mut self, tx_id: u64) -> Option<&TemplateTransaction> { - self.transactions.iter().find(|tx| tx.tx_id == tx_id + 1) + self.transactions.iter().find(|tx| tx.tx_id == tx_id) } fn new_tx(&mut self) -> TemplateTransaction {