mirror of
https://github.com/Noratrieb/cluelessh.git
synced 2026-01-15 17:05:05 +01:00
limits
This commit is contained in:
parent
890feee6d1
commit
ebf126343b
1 changed files with 4 additions and 0 deletions
|
|
@ -22,6 +22,7 @@ impl<'a> Parser<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn array<const N: usize>(&mut self) -> Result<[u8; N]> {
|
pub fn array<const N: usize>(&mut self) -> Result<[u8; N]> {
|
||||||
|
assert!(N < 100_000);
|
||||||
if self.0.len() < N {
|
if self.0.len() < N {
|
||||||
return Err(crate::client_error!("packet too short"));
|
return Err(crate::client_error!("packet too short"));
|
||||||
}
|
}
|
||||||
|
|
@ -34,6 +35,9 @@ impl<'a> Parser<'a> {
|
||||||
if self.0.len() < len {
|
if self.0.len() < len {
|
||||||
return Err(crate::client_error!("packet too short"));
|
return Err(crate::client_error!("packet too short"));
|
||||||
}
|
}
|
||||||
|
if len > 100_000 {
|
||||||
|
return Err(crate::client_error!("bytes too long: {len}"));
|
||||||
|
}
|
||||||
let result = &self.0[..len];
|
let result = &self.0[..len];
|
||||||
self.0 = &self.0[len..];
|
self.0 = &self.0[len..];
|
||||||
Ok(result)
|
Ok(result)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue