fix(client): reject invalid negotiated packet length

This commit is contained in:
Nils Andreas Svee committed 2026-05-10 20:56:43 +07:00
1 parent e3bb28c559
commit 294d97a13d
2 files changed
+29

No files matched your search

+5
View File
@@ -48,6 +48,11 @@ pub(crate) fn validate_negotiated_params(
});
}
validate_duration_restriction(requested.duration_ns, returned.duration_ns)?;
if returned.length < 0 {
return Err(ClientError::NegotiationRejected {
reason: "length must be non-negative".to_owned(),
});
}
if returned.length > requested.length {
return Err(ClientError::NegotiationRejected {
reason: "length increased".to_owned(),