mirror of
https://github.com/n0-computer/noq.git
synced 2026-09-23 19:48:19 +00:00
Fix panic on malformed short header
This commit is contained in:
committed by
Dirkjan Ochtman
parent
d72bc0fc6f
commit
9eb76ee6bb
@@ -514,7 +514,11 @@ impl PlainHeader {
|
||||
let first = buf.get::<u8>()?;
|
||||
if first & LONG_HEADER_FORM == 0 {
|
||||
let spin = first & SPIN_BIT != 0;
|
||||
let dst_cid = ConnectionId::new(&buf.bytes()[..local_cid_len]);
|
||||
let dst_cid = ConnectionId::new(
|
||||
&buf.bytes()
|
||||
.get(..local_cid_len)
|
||||
.ok_or(PacketDecodeError::InvalidHeader("cid out of bounds"))?,
|
||||
);
|
||||
buf.advance(local_cid_len);
|
||||
|
||||
Ok(PlainHeader::Short {
|
||||
|
||||
Reference in New Issue
Block a user