From 6d713a1a9b1d93d6e58a8c4a263691e1d2b1f222 Mon Sep 17 00:00:00 2001 From: p1-bmu Date: Thu, 19 Nov 2020 15:35:17 +0100 Subject: [PATCH] corenet: add more checks on the decoded PDU --- pycrate_corenet/ProcProto.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pycrate_corenet/ProcProto.py b/pycrate_corenet/ProcProto.py index 983e823..f03fe4d 100644 --- a/pycrate_corenet/ProcProto.py +++ b/pycrate_corenet/ProcProto.py @@ -159,7 +159,7 @@ class LinkSigProc(SigProc): select the expected content in self.Cont, according to the pdu type select the potential decoders in self.Decod - raise HNBAPErr if an error requiring procedure rejection is found + raise Exception if an error requiring procedure rejection is found when unknown identifiers are encountered: IE buffer value is set with key 'id_%id', @@ -170,7 +170,7 @@ class LinkSigProc(SigProc): """ # 1) select the correct PDU and content ptype = pdu[0][:3] - if ptype == 'out': + if ptype == 'out': # some 3G RAN procedure have only 'outcome' pdu # which are changed to 'suc' ptype = 'suc' @@ -188,8 +188,8 @@ class LinkSigProc(SigProc): # self._log('WNG', 'decode_pdu: incorrect PDU criticality, %s' % val['criticality']) # # 3) ensure the PDU content has been properly decoded - if not isinstance(val['value'], tuple) or \ - val['value'][0] != Cont._tr._name: + if not isinstance(val, dict) or 'value' not in val \ + or not isinstance(val['value'], tuple) or val['value'][0] != Cont._tr._name: raise(CorenetErr('invalid PDU content')) # # 4) get the value part of the PDU with IEs and Extensions,