diff options
author | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2017-01-13 03:12:08 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2017-01-23 11:59:01 +0000 |
commit | 93bafb611a58293e0353320a14db298133c9d99a (patch) | |
tree | 4ba6d276b7f5e2fda43f21b765d7cca8c6b00d5e /openbsc/src/utils | |
parent | 59504dc80fe8c0d9a18994d82586a550c7efa341 (diff) |
cosmetic: use osmo_strlcpy() everywhere
Shorten some code and make obvious to the reader that the string copy is done
in a safe way.
Change-Id: I900726cf06d34128db22a3d3d911ee0d1423b1bd
Diffstat (limited to 'openbsc/src/utils')
-rw-r--r-- | openbsc/src/utils/meas_vis.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/openbsc/src/utils/meas_vis.c b/openbsc/src/utils/meas_vis.c index 061a7a4ce..316d20318 100644 --- a/openbsc/src/utils/meas_vis.c +++ b/openbsc/src/utils/meas_vis.c @@ -73,7 +73,7 @@ static struct ms_state *find_alloc_ms(const char *imsi) ms = find_ms(imsi); if (!ms) { ms = talloc_zero(NULL, struct ms_state); - strncpy(ms->imsi, imsi, sizeof(ms->imsi)-1); + osmo_strlcpy(ms->imsi, imsi, sizeof(ms->imsi)); ms->ul._lbl[0] = ms->ul.label; ms->dl._lbl[0] = ms->dl.label; llist_add_tail(&ms->list, &g_st.ms_list); @@ -88,7 +88,7 @@ static int handle_meas(struct msgb *msg) struct ms_state *ms = find_alloc_ms(mfm->imsi); time_t now = time(NULL); - strncpy(ms->name, mfm->name, sizeof(ms->imsi)-1); + osmo_strlcpy(ms->name, mfm->name, sizeof(ms->name)); memcpy(&ms->mr, &mfm->mr, sizeof(ms->mr)); ms->ul.last_update = now; if (ms->mr.flags & MEAS_REP_F_DL_VALID) |