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:
parent
ca30a508aa
commit
1cde6da007
@ -1433,6 +1433,10 @@ class Stc15Protocol(Stc15AProtocol):
|
|||||||
if len(response) >= 8:
|
if len(response) >= 8:
|
||||||
self.uid = response[1: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):
|
def program_flash(self, data):
|
||||||
"""Program the MCU's flash memory."""
|
"""Program the MCU's flash memory."""
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user