tlv: Don't raise exception if somebody passes empty data to TLV decoder

Change-Id: Id46994029d9b3cd6b67f4f7ee619466602cc8142
This commit is contained in:
Harald Welte 2022-02-11 16:29:32 +01:00
parent c975251a48
commit e4a6eafc6f
1 changed files with 2 additions and 0 deletions

View File

@ -232,6 +232,8 @@ class TLV_IE(IE):
return self._encode_tag() + self._encode_len(val) + val
def from_tlv(self, do: bytes):
if len(do) == 0:
return {}, b''
(rawtag, remainder) = self.__class__._parse_tag_raw(do)
if rawtag:
if rawtag != self.tag: