stc8: check length of status packet

Fixes a fuzzing error.
This commit is contained in:
Grigori Goronzy 2018-08-21 13:15:57 +02:00
parent 11d2ea22e6
commit ce251f9d30

View File

@ -1569,6 +1569,9 @@ class Stc8Protocol(Stc15Protocol):
def initialize_status(self, packet):
"""Decode status packet and store basic MCU info"""
if len(packet) < 39:
raise StcProtocolException("invalid status packet")
self.mcu_clock_hz, = struct.unpack(">I", packet[1:5])
self.external_clock = False
# all ones means no calibration