From 2f40fa5363605bfadadbf8a7b1191ad6e59c1bac Mon Sep 17 00:00:00 2001 From: Jan Pochyla Date: Mon, 29 May 2017 17:43:38 +0200 Subject: [PATCH] apps.fido_u2f: handle init cont frame --- src/apps/fido_u2f/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/apps/fido_u2f/__init__.py b/src/apps/fido_u2f/__init__.py index e4e3048107..b376b7d2e5 100644 --- a/src/apps/fido_u2f/__init__.py +++ b/src/apps/fido_u2f/__init__.py @@ -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: