proto: Reject RetryToken with extra bytes

This probably won't affect much, but is slightly more defensive.
This commit is contained in:
Phoenix Kahlo
2024-12-21 14:46:32 -06:00
parent fe67e7cd64
commit bfbeecdc1c
+5
View File
@@ -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,