This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Max gerrit-no-reply at lists.osmocom.orgMax has submitted this change and it was merged. ( https://gerrit.osmocom.org/11937 )
Change subject: osmo_ipa: add extended checks
......................................................................
osmo_ipa: add extended checks
Make sure we properly handle None objects.
Change-Id: If5ddc04b8a5dc26e56e5f5bbec7f28cf0af4a97b
---
M osmopy/osmo_ipa.py
1 file changed, 5 insertions(+), 1 deletion(-)
Approvals:
Jenkins Builder: Verified
Pau Espin Pedrol: Looks good to me, approved
diff --git a/osmopy/osmo_ipa.py b/osmopy/osmo_ipa.py
index 41865c1..462c4ec 100755
--- a/osmopy/osmo_ipa.py
+++ b/osmopy/osmo_ipa.py
@@ -106,8 +106,9 @@
Strip IPA protocol header correctly removing extension if present
Returns data length, IPA protocol, extension (or None if not defined for a give protocol) and the data without header
"""
- if not len(data):
+ if data == None or len(data) == 0:
return None, None, None, None
+
(dlen, proto) = struct.unpack('>HB', data[:3])
if self.PROTO['OSMO'] == proto or self.PROTO['CCM'] == proto: # there's extension which we have to unpack
return struct.unpack('>HBB', data[:4]) + (data[4:], ) # length, protocol, extension, data
@@ -117,6 +118,9 @@
"""
Split the data which contains multiple concatenated IPA messages into tuple (first, rest) where rest contains remaining messages, first is the single IPA message
"""
+ if data == None or len(data) == 0:
+ return None, None
+
(length, _, _, _) = self.del_header(data)
return data[:(length + 3)], data[(length + 3):]
--
To view, visit https://gerrit.osmocom.org/11937
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: python/osmo-python-tests
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: If5ddc04b8a5dc26e56e5f5bbec7f28cf0af4a97b
Gerrit-Change-Number: 11937
Gerrit-PatchSet: 1
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181126/a4c43e29/attachment.htm>