Skip to content

Commit

Permalink
fix: check if key exists in attributes before accessing the dict
Browse files Browse the repository at this point in the history
  • Loading branch information
peterhoneder committed Oct 26, 2018
1 parent 2d64523 commit c11d5de
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pyrad/packet.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,10 +409,11 @@ def DecodePacket(self, packet):
'Attribute length is too small (%d)' % attrlen)

value = packet[2:attrlen]
key_decoded = self._DecodeKey(key)
if key == 26:
for (key, value) in self._PktDecodeVendorAttribute(value):
self.setdefault(key, []).append(value)
elif self.dict.attributes[self._DecodeKey(key)].type == 'tlv':
elif key_decoded in self.dict.attributes and self.dict.attributes[key_decoded].type == 'tlv':
self._PktDecodeTlvAttribute(key,value)
else:
self.setdefault(key, []).append(value)
Expand Down

0 comments on commit c11d5de

Please sign in to comment.