Windows: Protect the SERICE_RECORD is_valid function a little more

The request to .Order could fail depending on where the structure lies
in memory.
This commit is contained in:
Mike Auty
2024-11-30 13:36:17 +00:00
parent ba98b088cb
commit 2dc1686289
@@ -14,13 +14,16 @@ class SERVICE_RECORD(objects.StructType):
def is_valid(self) -> bool:
"""Determine if the structure is valid."""
if self.Order < 0 or self.Order > 0xFFFF:
return False
try:
_ = self.State.description
_ = self.Start.description
except ValueError:
if self.Order < 0 or self.Order > 0xFFFF:
return False
try:
_ = self.State.description
_ = self.Start.description
except ValueError:
return False
except exceptions.InvalidAddressException:
return False
return True