mirror of
https://github.com/ferrous-systems/embedded-trainings-2020.git
synced 2025-01-25 07:18:08 +00:00
length check in usb-3
This commit is contained in:
parent
60efef8f40
commit
9e48aace87
1 changed files with 3 additions and 0 deletions
|
@ -76,6 +76,9 @@ fn on_event(usbd: &USBD, ep0in: &mut Ep0In, event: Event) {
|
|||
// TODO send back a valid device descriptor, truncated to `length` bytes
|
||||
// let desc = usb2::device::Descriptor { .. };
|
||||
let resp = [];
|
||||
|
||||
// ensure we're not overstepping boundaries
|
||||
assert!(resp.len() <= length as usize);
|
||||
ep0in.start(&resp, usbd);
|
||||
}
|
||||
Request::SetAddress { .. } => {
|
||||
|
|
Loading…
Reference in a new issue