pycrate-org / pycrate

A Python library to ease the development of encoders and decoders for various protocols and file formats, especially telecom ones. Provides an ASN.1 compiler and a CSN.1 runtime.
https://github.com/pycrate-org/pycrate
GNU Lesser General Public License v2.1
32 stars 8 forks source link

TS24501_UEPOL : UEPolSectionSublist length calculation does not include 3 octets for PLMN #6

Closed maddenj-ie closed 4 months ago

maddenj-ie commented 5 months ago

https://github.com/pycrate-org/pycrate/blob/bc4fd87d24a4ddfc191bc7779c94eaf723ba25c2/pycrate_mobile/TS24501_UEPOL.py#L122

This appears to have been changed recently.

TS 24.501 D.6.2 Figure D.6.2.3: UE policy section management sublist.

 

87654321 | ' | ' | -- | -- | -- Length of UE policy section management sublist | | octet d | | | | octet d+1  | MCC digit 2 | MCC digit 1 | octet d+2 | MNC digit 3 | MCC digit 3 | octet d+3 | MNC digit 2 | MNC digit 1 | octet d+4 | UE policy section management sublist contents | | octet d+5 | | | | octet y |

From the spec:

Length of UE policy section management sublist (octets d to d+1) This field contains the binary encoding of the length of the UE policy section management sublist in units of octets.

The Length of UE policy section management sublist should be the length of the sublists contents + length of the plmn (mcc+mnc) 3 octets.

mitshell commented 4 months ago

This should fix the length prefix according to the spec: https://github.com/pycrate-org/pycrate/commit/1fe3040b4652078a397cf4e6136bb96ed894791d Thanks for reporting

maddenj-ie commented 4 months ago

Thanks @mitshell When will the next release be?

maddenj-ie commented 3 months ago

@mitshell I've tested this and can confirm the fix.