srsran / srsRAN_4G

Open source SDR 4G software suite from Software Radio Systems (SRS) https://docs.srsran.com/projects/4g
https://www.srsran.com
GNU Affero General Public License v3.0
3.45k stars 1.14k forks source link

Indexing Error in s1ap_mccmnc_to_plmn #217

Closed cpetersgit closed 6 years ago

cpetersgit commented 6 years ago

In the file, srsenb/hdr/upper/common_enb.h, in the function s1ap_mccmnc_to_plmn there is an indexing error in nibbles in the else for the case of the 3-digit MNC. Compare to the 2 digit case you can see it.

Existing Code: // 3-digit MNC nibbles[5] = (mnc & 0x0F00) >> 8; // MNC digit 1 nibbles[4] = (mnc & 0x00F0) >> 4; // MNC digit 2 nibbles[2] = (mnc & 0x000F); // MNC digit 3

Corrected Code: // 3-digit MNC nibbles[2] = (mnc & 0x0F00) >> 8; // MNC digit 1 nibbles[5] = (mnc & 0x00F0) >> 4; // MNC digit 2 nibbles[4] = (mnc & 0x000F); // MNC digit 3

andrepuschmann commented 6 years ago

Thanks for that. That will be fixed in next release.