]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
quic: move all_consuming check to callee
authorPhilippe Antoine <pantoine@oisf.net>
Mon, 17 Feb 2025 10:04:50 +0000 (11:04 +0100)
committerVictor Julien <victor@inliniac.net>
Wed, 19 Feb 2025 15:34:12 +0000 (16:34 +0100)
Will alow to have decode_frames accept one additional parameter
with past fragment data

rust/src/quic/frames.rs
rust/src/quic/parser.rs

index 0266850fd38ad84555150622f2b353b51e367827..a3afc27567b898207357ff2bb478ee8ab67594cc 100644 (file)
@@ -541,7 +541,7 @@ impl Frame {
     }
 
     pub(crate) fn decode_frames(input: &[u8]) -> IResult<&[u8], Vec<Frame>, QuicError> {
-        let (rest, mut frames) = many0(complete(Frame::decode_frame))(input)?;
+        let (rest, mut frames) = all_consuming(many0(complete(Frame::decode_frame)))(input)?;
 
         // reassemble crypto fragments : first find total size
         let mut crypto_max_size = 0;
index 126973633bac69b1ca0bf1208100dfaa0fc11518..fbb8195ce12adfa43f4765afea97d3d6d2dc15c4 100644 (file)
@@ -17,7 +17,7 @@
 use super::error::QuicError;
 use super::frames::Frame;
 use nom7::bytes::complete::take;
-use nom7::combinator::{all_consuming, map};
+use nom7::combinator::map;
 use nom7::number::complete::{be_u24, be_u32, be_u8};
 use nom7::IResult;
 use std::convert::TryFrom;
@@ -393,7 +393,7 @@ impl QuicHeader {
 
 impl QuicData {
     pub(crate) fn from_bytes(input: &[u8]) -> Result<QuicData, QuicError> {
-        let (_, frames) = all_consuming(Frame::decode_frames)(input)?;
+        let (_, frames) = Frame::decode_frames(input)?;
         Ok(QuicData { frames })
     }
 }