Merge branch 'assert_maxlen' into 'main'
tor-cell: Assert data length in Data cells See merge request tpo/core/arti!800
This commit is contained in:
commit
9f73ddd440
|
@ -400,8 +400,9 @@ impl Data {
|
|||
|
||||
/// Construct a new data cell from a provided vector of bytes.
|
||||
///
|
||||
/// The vector _must_ have fewer than [`Data::MAXLEN`] bytes.
|
||||
/// The vector _must_ not have more than [`Data::MAXLEN`] bytes.
|
||||
fn new_unchecked(body: Vec<u8>) -> Self {
|
||||
debug_assert!(body.len() <= Data::MAXLEN);
|
||||
Data { body }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue