Explicitly limit size of data.

This commit is contained in:
Heiko Schaefer 2021-08-25 13:07:25 +02:00
parent 6d08b34a87
commit f9bad31d63

View file

@ -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,