Skip to content

Commit

Permalink
Ensure that the data has been fully received before unpack. rospogrig…
Browse files Browse the repository at this point in the history
  • Loading branch information
xZetsubou committed Apr 30, 2024
1 parent bb90383 commit 6d07160
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions custom_components/localtuya/core/pytuya/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,10 @@ def add_data(self, data):
self.buffer = self.buffer[prefix_offset:]

header = parse_header(self.buffer, logger=self)
# Check if the all data for the message has been received.
if len(self.buffer) < header.total_length:
break

hmac_key = self.local_key if self.version >= 3.4 else None
no_retcode = False
msg = unpack_message(
Expand Down

0 comments on commit 6d07160

Please sign in to comment.