Skip to content

Commit

Permalink
Validate preferred_address transport parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralith committed Mar 25, 2024
1 parent a2a214b commit 1edf915
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions quinn-proto/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3207,6 +3207,19 @@ impl Connection {
));
}

if let Some(preferred) = params.preferred_address {
if self.side.is_server() {
return Err(TransportError::TRANSPORT_PARAMETER_ERROR(
"client sent preferred_address",
));
}
if preferred.connection_id.is_empty() {
return Err(TransportError::TRANSPORT_PARAMETER_ERROR(
"preferred_address must not have a zero-length connection ID",
));
}
}

self.set_peer_params(params);

Ok(())
Expand Down

0 comments on commit 1edf915

Please sign in to comment.