lynxis lazus has submitted this change. (
https://gerrit.osmocom.org/c/osmo-msc/+/39565?usp=email )
(
3 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: libvlr: replace strncpy with OSMO_STRLCPY_ARRAY
......................................................................
libvlr: replace strncpy with OSMO_STRLCPY_ARRAY
The compile warns about these strncpys because they
might not null terminated.
Even the next line ensures this.
Also replace osmo_strlcpy with OSMO_STRLCPY_ARRAY
when possible.
Change-Id: I96a27ef42cb06dd2365f5c9902933323c7caf9a8
---
M src/libvlr/vlr_auth_fsm.c
M src/libvlr/vlr_lu_fsm.c
M src/libvlr/vlr_sgs.c
3 files changed, 3 insertions(+), 5 deletions(-)
Approvals:
pespin: Looks good to me, but someone else must approve
daniel: Looks good to me, but someone else must approve
Jenkins Builder: Verified
laforge: Looks good to me, approved
diff --git a/src/libvlr/vlr_auth_fsm.c b/src/libvlr/vlr_auth_fsm.c
index b4ebd05..b3bd236 100644
--- a/src/libvlr/vlr_auth_fsm.c
+++ b/src/libvlr/vlr_auth_fsm.c
@@ -540,8 +540,7 @@
LOGVSUBP(LOGL_ERROR, vsub, "IMSI in ID RESP differs:"
" %s\n", mi_string);
} else {
- strncpy(vsub->imsi, mi_string, sizeof(vsub->imsi));
- vsub->imsi[sizeof(vsub->imsi)-1] = '\0';
+ OSMO_STRLCPY_ARRAY(vsub->imsi, mi_string);
}
/* retry with identity=IMSI */
afp->by_imsi = true;
diff --git a/src/libvlr/vlr_lu_fsm.c b/src/libvlr/vlr_lu_fsm.c
index 96d1861..20a69d4 100644
--- a/src/libvlr/vlr_lu_fsm.c
+++ b/src/libvlr/vlr_lu_fsm.c
@@ -1573,8 +1573,7 @@
lfp->is_utran = is_utran;
lfp->assign_tmsi = assign_tmsi;
if (imsi) {
- strncpy(lfp->imsi, imsi, sizeof(lfp->imsi)-1);
- lfp->imsi[sizeof(lfp->imsi)-1] = '\0';
+ OSMO_STRLCPY_ARRAY(lfp->imsi, imsi);
lfp->lu_by_tmsi = false;
}
fi->priv = lfp;
diff --git a/src/libvlr/vlr_sgs.c b/src/libvlr/vlr_sgs.c
index f7fea09..755db1e 100644
--- a/src/libvlr/vlr_sgs.c
+++ b/src/libvlr/vlr_sgs.c
@@ -96,7 +96,7 @@
vsub->sgs.mminfo_cb = mminfo_cb;
vlr_subscr_set_imsi(vsub, imsi);
vlr_subscr_set_last_used_eutran_plmn_id(vsub, last_eutran_plmn);
- osmo_strlcpy(vsub->sgs.mme_name, mme_name, sizeof(vsub->sgs.mme_name));
+ OSMO_STRLCPY_ARRAY(vsub->sgs.mme_name, mme_name);
osmo_fsm_inst_dispatch(vsub->sgs_fsm, SGS_UE_E_RX_LU_FROM_MME, NULL);
--
To view, visit
https://gerrit.osmocom.org/c/osmo-msc/+/39565?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I96a27ef42cb06dd2365f5c9902933323c7caf9a8
Gerrit-Change-Number: 39565
Gerrit-PatchSet: 4
Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>