]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
dcerpc: convert transaction list to vecdeque for UDP 9007/head
authorPhilippe Antoine <pantoine@oisf.net>
Wed, 24 Aug 2022 08:24:51 +0000 (10:24 +0200)
committerVictor Julien <vjulien@oisf.net>
Sat, 10 Jun 2023 08:01:06 +0000 (10:01 +0200)
As was done for TCP in dfe76bb90 and d745d28d4

Ticket: #5518
(cherry picked from commit bf43011a43a6d542ab2f85aa61986340ed8254c8)

rust/src/dcerpc/dcerpc_udp.rs

index 1ed151859b6241109a6994b7d9ff5104632f16bd..3ed1801b2b07d3f47e0e5566221851ed2f2461bb 100644 (file)
@@ -22,6 +22,7 @@ use crate::core;
 use crate::dcerpc::dcerpc::{
     DCERPCTransaction, DCERPC_TYPE_REQUEST, DCERPC_TYPE_RESPONSE, PFCL1_FRAG, PFCL1_LASTFRAG,
 };
+use std::collections::VecDeque;
 use crate::dcerpc::parser;
 
 // Constant DCERPC UDP Header length
@@ -53,14 +54,14 @@ pub struct DCERPCHdrUdp {
 #[derive(Debug)]
 pub struct DCERPCUDPState {
     pub tx_id: u64,
-    pub transactions: Vec<DCERPCTransaction>,
+    pub transactions: VecDeque<DCERPCTransaction>,
 }
 
 impl DCERPCUDPState {
     pub fn new() -> DCERPCUDPState {
         return DCERPCUDPState {
             tx_id: 0,
-            transactions: Vec::new(),
+            transactions: VecDeque::new(),
         };
     }
 
@@ -138,8 +139,8 @@ impl DCERPCUDPState {
         if otx.is_none() {
             let ntx = self.create_tx(hdr);
             SCLogDebug!("new tx id {}, last tx_id {}, {} {}", ntx.id, self.tx_id, ntx.seqnum, ntx.activityuuid[0]);
-            self.transactions.push(ntx);
-            otx = self.transactions.last_mut();
+            self.transactions.push_back(ntx);
+            otx = self.transactions.back_mut();
         }
 
         if let Some(tx) = otx {