Skip to content

Commit

Permalink
proto: Reject RetryToken with extra bytes
Browse files Browse the repository at this point in the history
This probably won't affect much, but is slightly more defensive.
  • Loading branch information
gretchenfrage committed Dec 24, 2024
1 parent fe67e7c commit bfbeecd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions quinn-proto/src/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ impl RetryToken {
let orig_dst_cid = ConnectionId::decode_long(&mut reader)?;
let issued = decode_unix_secs(&mut reader)?;

if !reader.is_empty() {
// Consider extra bytes a decoding error (it may be from an incompatible endpoint)
return None;
}

Some(Self {
address,
orig_dst_cid,
Expand Down

0 comments on commit bfbeecd

Please sign in to comment.