1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-03 12:00:59 +00:00

wire: fix when the footer is too short

This commit is contained in:
Jan Pochyla 2016-11-15 18:09:45 +01:00
parent ecd8bd3b2a
commit e556aea42b

View File

@ -115,7 +115,10 @@ Pass report payloads as `memoryview` for cheaper slicing.
msg_footer = data_tail[:_MSG_FOOTER_LEN]
if len(msg_footer) < _MSG_FOOTER_LEN:
data_tail = yield # read report with the rest of checksum
msg_footer += data_tail[:_MSG_FOOTER_LEN - len(msg_footer)]
footer_tail = data_tail[:_MSG_FOOTER_LEN - len(msg_footer)]
if isinstance(msg_footer, memoryview):
msg_footer = bytearray(msg_footer)
msg_footer.extend(footer_tail)
data_checksum, = parse_message_footer(msg_footer)
if data_checksum != checksum: