1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-13 02:58:57 +00:00

bootloader: don't crash on empty usb queue

This commit is contained in:
Pavol Rusnak 2018-01-24 00:36:32 +01:00
parent 9fcb59c3ca
commit f6f6e8593a
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

View File

@ -210,7 +210,9 @@ static secbool bootloader_loop(secbool firmware_present)
#else
int r = usb_hid_read_blocking(USB_IFACE_NUM, buf, USB_PACKET_SIZE, USB_TIMEOUT);
#endif
ensure(sectrue * (r == USB_PACKET_SIZE), NULL);
if (r != USB_PACKET_SIZE) {
continue;
}
uint16_t msg_id;
uint32_t msg_size;
if (sectrue != msg_parse_header(buf, &msg_id, &msg_size)) {