From f5daf650a79145d8686dcd506b9a68e0101a5e48 Mon Sep 17 00:00:00 2001 From: fazledyn-or Date: Mon, 9 Oct 2023 17:19:38 +0600 Subject: [PATCH] FIX: Updated expression to fix logical short circuit --- custom_components/ble_monitor/ble_parser/hormann.py | 2 +- custom_components/ble_monitor/ble_parser/teltonika.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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: