From c1f8590c5e9e3095fc2da615a0240e7da3a18a2d Mon Sep 17 00:00:00 2001 From: Patrick Pichon Date: Fri, 13 Oct 2023 10:02:13 +0200 Subject: [PATCH] enforce payload size checking --- Modules/tools.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Modules/tools.py b/Modules/tools.py index 77ccfc9c0..818698dd2 100644 --- a/Modules/tools.py +++ b/Modules/tools.py @@ -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: @@ -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]