proto: fix NewConnectionId size bound

This commit is contained in:
Dirkjan Ochtman
2025-07-21 12:18:35 +02:00
committed by Benjamin Saunders
parent 1f8d2c26b7
commit 446cd72e38
2 changed files with 6 additions and 2 deletions
+2 -2
View File
@@ -28,7 +28,7 @@ use crate::{
coding::BufMutExt,
config::{ServerConfig, TransportConfig},
crypto::{self, KeyPair, Keys, PacketKey},
frame::{self, Close, Datagram, FrameStruct, NewToken},
frame::{self, Close, Datagram, FrameStruct, NewConnectionId, NewToken},
packet::{
FixedLengthConnectionIdParser, Header, InitialHeader, InitialPacket, LongType, Packet,
PacketNumber, PartialDecode, SpaceId,
@@ -3334,7 +3334,7 @@ impl Connection {
}
// NEW_CONNECTION_ID
while buf.len() + 44 < max_size {
while buf.len() + NewConnectionId::SIZE_BOUND < max_size {
let issued = match space.pending.new_cids.pop() {
Some(x) => x,
None => break,
+4
View File
@@ -884,6 +884,10 @@ impl NewConnectionId {
}
}
impl FrameStruct for NewConnectionId {
const SIZE_BOUND: usize = 1 + 8 + 8 + 1 + MAX_CID_SIZE + RESET_TOKEN_SIZE;
}
/// Smallest number of bytes this type of frame is guaranteed to fit within.
pub(crate) const RETIRE_CONNECTION_ID_SIZE_BOUND: usize = 9;