Skip to content

Commit

Permalink
Merge pull request from GHSA-hvhj-4r52-8568
Browse files Browse the repository at this point in the history
  • Loading branch information
larseggert authored Apr 11, 2024
1 parent c44e536 commit b3cf65f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion neqo-transport/src/packet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,10 @@ impl<'a> PublicPacket<'a> {
if packet_type == PacketType::Retry {
let header_len = decoder.offset();
let expansion = retry::expansion(version);
let token = Self::opt(decoder.decode(decoder.remaining() - expansion))?;
let token = decoder
.remaining()
.checked_sub(expansion)
.map_or(Err(Error::InvalidPacket), |v| Self::opt(decoder.decode(v)))?;
if token.is_empty() {
return Err(Error::InvalidPacket);
}
Expand Down

0 comments on commit b3cf65f

Please sign in to comment.