From 77d5c7c324bcdb806632731096037e035c8d6000 Mon Sep 17 00:00:00 2001 From: Philippe Antoine Date: Thu, 9 Oct 2025 20:32:00 +0200 Subject: [PATCH] http2: fix parsing of goaway frames There was a last stream id before the error code As per section 6.8 of RFC 7540 Ticket: 7991 (cherry picked from commit 9a4a29e2189fbd8e5bf47d00b0bcdecaf2aa7d04) --- rust/src/http2/http2.rs | 2 +- rust/src/http2/parser.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/rust/src/http2/http2.rs b/rust/src/http2/http2.rs index af6e22f69c..ed8a2abc82 100644 --- a/rust/src/http2/http2.rs +++ b/rust/src/http2/http2.rs @@ -69,7 +69,7 @@ pub enum HTTP2ConnectionState { const HTTP2_FRAME_HEADER_LEN: usize = 9; const HTTP2_MAGIC_LEN: usize = 24; -const HTTP2_FRAME_GOAWAY_LEN: usize = 4; +const HTTP2_FRAME_GOAWAY_LEN: usize = 8; const HTTP2_FRAME_RSTSTREAM_LEN: usize = 4; const HTTP2_FRAME_PRIORITY_LEN: usize = 5; const HTTP2_FRAME_WINDOWUPDATE_LEN: usize = 4; diff --git a/rust/src/http2/parser.rs b/rust/src/http2/parser.rs index 239d4e942a..9d79b8cf1a 100644 --- a/rust/src/http2/parser.rs +++ b/rust/src/http2/parser.rs @@ -161,6 +161,7 @@ pub struct HTTP2FrameGoAway { } pub fn http2_parse_frame_goaway(i: &[u8]) -> IResult<&[u8], HTTP2FrameGoAway> { + let (i, _last_stream_id) = be_u32(i)?; let (i, errorcode) = be_u32(i)?; Ok((i, HTTP2FrameGoAway { errorcode })) }