Skip to content

Commit

Permalink
enforce payload size checking
Browse files Browse the repository at this point in the history
  • Loading branch information
pipiche38 committed Oct 13, 2023
1 parent 074d35c commit c1f8590
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Modules/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1036,6 +1036,9 @@ def getAttributeValue(self, MsgSrcAddr, MsgSrcEp, MsgClusterId, MsgAttrID):
def retreive_cmd_payload_from_8002(Payload):

ManufacturerCode = None
if len(Payload) < 2:
return (None, None, None, None, None, None)

fcf = Payload[:2]

try:
Expand All @@ -1047,6 +1050,9 @@ def retreive_cmd_payload_from_8002(Payload):
if GlobalCommand is None:
return (None, None, None, None, None, None)

if len(Payload) < 6:
return (None, None, None, None, None, None)

if is_manufspecific_8002_payload(fcf):
ManufacturerCode = Payload[4:6] + Payload[2:4]
Sqn = Payload[6:8]
Expand Down

0 comments on commit c1f8590

Please sign in to comment.