From 614ffb0761d421a797ec25f8f0b1e05b85f126f6 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Tue, 30 Apr 2019 11:09:52 -0500 Subject: [PATCH] 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. --- src/sim-auth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sim-auth.c b/src/sim-auth.c index 0434350d..6b77afd9 100644 --- a/src/sim-auth.c +++ b/src/sim-auth.c @@ -659,10 +659,10 @@ static char *build_nai(const char *imsi) strncpy(mcc, imsi, 3); if (strlen(imsi) == 16) { - strncpy(mnc, imsi + 3, 3); + memcpy(mnc, imsi + 3, 3); } else { 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",