Explicitly limit size of data.
This commit is contained in:
parent
6d08b34a87
commit
f9bad31d63
1 changed files with 3 additions and 0 deletions
|
@ -17,11 +17,14 @@ pub(crate) struct Command {
|
||||||
pub p1: u8,
|
pub p1: u8,
|
||||||
pub p2: u8,
|
pub p2: u8,
|
||||||
|
|
||||||
|
// NOTE: data must be smaller than 64 kbyte
|
||||||
pub data: Vec<u8>,
|
pub data: Vec<u8>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Command {
|
impl Command {
|
||||||
pub fn new(cla: u8, ins: u8, p1: u8, p2: u8, data: Vec<u8>) -> Self {
|
pub fn new(cla: u8, ins: u8, p1: u8, p2: u8, data: Vec<u8>) -> Self {
|
||||||
|
assert!(data.len() < 0x10000, "'data' too big, must be <64 kbyte");
|
||||||
|
|
||||||
Command {
|
Command {
|
||||||
cla,
|
cla,
|
||||||
ins,
|
ins,
|
||||||
|
|
Loading…
Reference in a new issue