fix(client): validate packet length configuration
This commit is contained in:
1 parent
1a98858b7a
commit
e3bb28c559
5 files changed
+38
-5
No files matched your search
@@ -11,7 +11,10 @@ use irtt_proto::{
|
||||
};
|
||||
|
||||
use crate::{
|
||||
config::{ClientConfig, RecvBudget, RunMode, MAX_DSCP_CODEPOINT, MAX_SERVER_FILL_BYTES},
|
||||
config::{
|
||||
ClientConfig, RecvBudget, RunMode, MAX_DSCP_CODEPOINT, MAX_SERVER_FILL_BYTES,
|
||||
MAX_UDP_PAYLOAD_LENGTH,
|
||||
},
|
||||
error::ClientError,
|
||||
event::{
|
||||
ClientEvent, OneWayDelaySample, OpenOutcome, ReceivedStatsSample, RttSample, ServerTiming,
|
||||
@@ -782,6 +785,11 @@ fn validate_protocol_config(config: &ClientConfig) -> Result<(), ClientError> {
|
||||
reason: format!("dscp must be <= {MAX_DSCP_CODEPOINT}"),
|
||||
});
|
||||
}
|
||||
if config.length > MAX_UDP_PAYLOAD_LENGTH {
|
||||
return Err(ClientError::InvalidConfig {
|
||||
reason: format!("packet length must be <= {MAX_UDP_PAYLOAD_LENGTH}"),
|
||||
});
|
||||
}
|
||||
|
||||
if let Some(fill) = &config.server_fill {
|
||||
let len = fill.len();
|
||||
|
||||
Reference in new issue
Block a user