From: Philippe Antoine Date: Mon, 21 Nov 2022 15:21:19 +0000 (+0100) Subject: http2: support padded data frames X-Git-Tag: suricata-6.0.9~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9cc92b8dd59ea97e0a9051542d34680e53afc31b;p=thirdparty%2Fsuricata.git http2: support padded data frames Ticket: #5691 (cherry picked from commit c6349d3cfcab47224b49293688ca18242ccbdb21) --- diff --git a/rust/src/http2/http2.rs b/rust/src/http2/http2.rs index c9aee2c969..6917e054cb 100644 --- a/rust/src/http2/http2.rs +++ b/rust/src/http2/http2.rs @@ -832,6 +832,7 @@ impl HTTP2State { let over = head.flags & parser::HTTP2_FLAG_HEADER_EOS != 0; let ftype = head.ftype; let sid = head.stream_id; + let padded = head.flags & parser::HTTP2_FLAG_HEADER_PADDED != 0; if dir == STREAM_TOSERVER { tx.frames_ts.push(HTTP2Frame { header: head, @@ -851,8 +852,12 @@ impl HTTP2State { if index > 0 { let tx_same = &mut self.transactions[index - 1]; let (files, flags) = self.files.get(dir); + let mut dinput = &rem[..hlsafe]; + if padded && rem.len() > 0 && usize::from(rem[0]) < hlsafe{ + dinput = &rem[1..hlsafe - usize::from(rem[0])]; + } match tx_same.decompress( - &rem[..hlsafe], + dinput, dir, sfcm, over, diff --git a/rust/src/http2/parser.rs b/rust/src/http2/parser.rs index cc76f225c3..87ab117a50 100644 --- a/rust/src/http2/parser.rs +++ b/rust/src/http2/parser.rs @@ -610,7 +610,7 @@ pub struct HTTP2FrameHeaders { //end stream pub const HTTP2_FLAG_HEADER_EOS: u8 = 0x1; pub const HTTP2_FLAG_HEADER_END_HEADERS: u8 = 0x4; -const HTTP2_FLAG_HEADER_PADDED: u8 = 0x8; +pub const HTTP2_FLAG_HEADER_PADDED: u8 = 0x8; const HTTP2_FLAG_HEADER_PRIORITY: u8 = 0x20; pub fn http2_parse_frame_headers<'a>(