Skip to content

Commit

Permalink
Merge pull request #1250 from fazledyn-or/Fix_Inappropriate_Logic
Browse files Browse the repository at this point in the history
FIX: Updated expression to fix logical short circuit
  • Loading branch information
Ernst79 authored Oct 9, 2023
2 parents 1f4d057 + f5daf65 commit ad2e45c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/hormann.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
2 changes: 1 addition & 1 deletion custom_components/ble_monitor/ble_parser/teltonika.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit ad2e45c

Please sign in to comment.