sim-auth: Use memcpy instead of strncpy

The code is not really copying strings but 2 or 3 character sof the MNC.
Make this clearer.
This commit is contained in:
Denis Kenzior 2019-04-30 11:09:52 -05:00
parent d3625f8e6f
commit 614ffb0761
1 changed files with 2 additions and 2 deletions

View File

@ -659,10 +659,10 @@ static char *build_nai(const char *imsi)
strncpy(mcc, imsi, 3); strncpy(mcc, imsi, 3);
if (strlen(imsi) == 16) { if (strlen(imsi) == 16) {
strncpy(mnc, imsi + 3, 3); memcpy(mnc, imsi + 3, 3);
} else { } else {
mnc[0] = '0'; mnc[0] = '0';
strncpy(mnc + 1, imsi + 3, 2); memcpy(mnc + 1, imsi + 3, 2);
} }
nai = g_strdup_printf("%s@ims.mnc%.3s.mcc%.3s.3gppnetwork.org", nai = g_strdup_printf("%s@ims.mnc%.3s.mcc%.3s.3gppnetwork.org",