1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 22:38:08 +00:00

apps.fido_u2f: handle init cont frame

This commit is contained in:
Jan Pochyla 2017-05-29 17:43:38 +02:00
parent 13a91451f6
commit 2f40fa5363

View File

@ -187,6 +187,11 @@ def read_cmd(iface: int) -> Cmd:
datalen = len(data)
seq = 0
if ifrm.cmd & _TYPE_MASK == _TYPE_CONT:
# unexpected cont packet, abort current msg
log.warning(__name__, '_TYPE_CONT')
return None
if datalen < bcnt:
databuf = bytearray(bcnt)
utils.memcpy(databuf, 0, data, 0, bcnt)
@ -255,6 +260,8 @@ def handle_reports(iface: int):
while True:
try:
req = yield from read_cmd(iface)
if req is None:
continue
resp = yield from dispatch_cmd(req)
send_cmd(resp, iface)
except Exception as e: