stc15: check that a UID has been received

Found by fuzzing. In some cases it's possible that we end up without
a valid UID. Detect and workaround.
This commit is contained in:
Grigori Goronzy 2017-09-24 14:44:02 +02:00
parent ca30a508aa
commit 1cde6da007

View File

@ -1433,6 +1433,10 @@ class Stc15Protocol(Stc15AProtocol):
if len(response) >= 8:
self.uid = response[1:8]
# we should have a UID at this point
if not self.uid:
raise StcProtocolException("UID is missing")
def program_flash(self, data):
"""Program the MCU's flash memory."""