laforge submitted this change.
esim.saip: derive nb_rec from efFileSize when the descriptor omits it
File.from_template copies the template's record count, so a profile whose
fileDescriptor carries no number of records but declares a larger
efFileSize kept the template default (EF.MSISDN: one 24-byte record from
FilesUsimOptional against a 68-byte, two-record file). ETSI TS 102 222
sizes a linear fixed EF as record length times record count; when the
descriptor is silent the declared size is the count.
The folder osmocom-pysim-saip-record-count of
hampushellsberg-dev/PySIM-upstream-patches on GitHub has the analysis
and a repro.
Change-Id: I191b234446c278a5252a903d170c3336d9e0c1ba
---
M pySim/esim/saip/__init__.py
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pySim/esim/saip/__init__.py b/pySim/esim/saip/__init__.py
index 2833fd0..5966897 100644
--- a/pySim/esim/saip/__init__.py
+++ b/pySim/esim/saip/__init__.py
@@ -366,8 +366,8 @@
if fd_dec['record_len']:
self.rec_len = fd_dec['record_len']
if efFileSize:
- if self.rec_len and self.nb_rec == None:
- # compute the number of records from file size and record length
+ if self.rec_len and not fd_dec['num_of_rec']:
+ # the profile's size wins over a template count when the descriptor omits it
self.nb_rec = self._file_size // self.rec_len
if fdb_dec['structure'] == 'linear_fixed':
self.file_type = 'LF'
To view, visit change 43984. To unsubscribe, or for help writing mail filters, visit settings.