Change in pysim[master]: fixup

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/.

dexter gerrit-no-reply at lists.osmocom.org
Mon Apr 1 13:50:37 UTC 2019


dexter has uploaded this change for review. ( https://gerrit.osmocom.org/13475


Change subject: fixup
......................................................................

fixup

Change-Id: Iecec05aeaca4ab4578a5a240802c01a24cd52597
---
M pySim/cards.py
1 file changed, 8 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/75/13475/1

diff --git a/pySim/cards.py b/pySim/cards.py
index 6a26dc7..fb84a8d 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -119,9 +119,16 @@
 		return sw
 
 	def update_ad(self, mnc):
+                #See also: 3GPP TS 31.102, chapter 4.2.18
+                mnclen = len(str(mnc))
+                if mnclen == 1:
+                        mnclen = 2
+                if mnclen > 3:
+			raise RuntimeError('unable to calculate proper mnclen')
+
 	        data = self._scc.read_binary(EF['AD'], length=None, offset=0)
                 size = len(data[0])/2
-                content = data[0][0:6] + "%02X" % len(str(mnc))
+                content = data[0][0:6] + "%02X" % mnclen
 		data, sw = self._scc.update_binary(EF['AD'], content)
 		return sw
 

-- 
To view, visit https://gerrit.osmocom.org/13475
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iecec05aeaca4ab4578a5a240802c01a24cd52597
Gerrit-Change-Number: 13475
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190401/e655d571/attachment.htm>


More information about the gerrit-log mailing list