tor-cell: Assert data length in Data cells
This commit adds a `debug_assert!` macro into the `new_unchecked()` function of the Data cell. Beside this, it also fixes a misleading comment regarding that limit.
This commit is contained in:
parent
b031616b5f
commit
fb2195b0cf
|
@ -399,8 +399,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