diff --git a/custom_components/ble_monitor/ble_parser/hormann.py b/custom_components/ble_monitor/ble_parser/hormann.py index e95750795..e85471149 100644 --- a/custom_components/ble_monitor/ble_parser/hormann.py +++ b/custom_components/ble_monitor/ble_parser/hormann.py @@ -18,7 +18,7 @@ def parse_hormann(self, data, source_mac, rssi): while data_size > 1: packet_size = data[packet_start] + 1 - if packet_size > 1 and packet_size <= packet_size: + if packet_size > 1 and packet_size <= data_size: packet = data[packet_start:packet_start + packet_size] packet_type = packet[1] diff --git a/custom_components/ble_monitor/ble_parser/teltonika.py b/custom_components/ble_monitor/ble_parser/teltonika.py index 3f290cdea..b4c33214c 100644 --- a/custom_components/ble_monitor/ble_parser/teltonika.py +++ b/custom_components/ble_monitor/ble_parser/teltonika.py @@ -33,7 +33,7 @@ def parse_teltonika(self, data, complete_local_name, source_mac, rssi): data_size = len(data) while data_size > 1: packet_size = data[packet_start] + 1 - if packet_size > 1 and packet_size <= packet_size: + if packet_size > 1 and packet_size <= data_size: packet = data[packet_start:packet_start + packet_size] packet_type = packet[1] if packet_type == 0x16 and packet_size > 4: