From dc529f3d787ec9f1e2a68c9029bbb2b6c1fd9087 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 30 Dec 2020 13:39:06 +0100 Subject: hnbgw: use OSMO_STRLCPY_ARRAY() instead of open coding it Change-Id: I4c539168597187408c31b906fd57844e0f165c9b --- src/hnbgw.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/hnbgw.c b/src/hnbgw.c index f18d2b1..dd157d7 100644 --- a/src/hnbgw.c +++ b/src/hnbgw.c @@ -195,10 +195,9 @@ struct ue_context *ue_context_alloc(struct hnb_context *hnb, const char *imsi, return NULL; ue->hnb = hnb; - if (imsi) { - strncpy(ue->imsi, imsi, sizeof(ue->imsi)); - ue->imsi[sizeof(ue->imsi)-1] = '\0'; - } else + if (imsi) + OSMO_STRLCPY_ARRAY(ue->imsi, imsi); + else ue->imsi[0] = '\0'; ue->tmsi = tmsi; ue->context_id = get_next_ue_ctx_id(hnb->gw); -- cgit v1.2.3