aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-03-08 18:30:22 +0100
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-03-20 00:21:01 +0000
commitca06e040cc115689fb10394cc566052576a638fc (patch)
tree279e0d62ccc46e9183228f82db8b13c9d077b948
parentac27a99021d404f9a15b952fbbc03789926b7ecc (diff)
bsc_/gprs_subscriber: fix: use osmo_strlcpy() to safely copy IMSI
Fixes: coverity scan CID 163918 Change-Id: I4b2760b006a0707928530b4390c6997b79b02981
-rw-r--r--openbsc/src/gprs/gprs_subscriber.c2
-rw-r--r--openbsc/src/libbsc/bsc_subscriber.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/openbsc/src/gprs/gprs_subscriber.c b/openbsc/src/gprs/gprs_subscriber.c
index 2042ec6eb..1bb51418a 100644
--- a/openbsc/src/gprs/gprs_subscriber.c
+++ b/openbsc/src/gprs/gprs_subscriber.c
@@ -157,7 +157,7 @@ struct gprs_subscr *gprs_subscr_get_or_create(const char *imsi)
gsub = gprs_subscr_alloc();
if (!gsub)
return NULL;
- strncpy(gsub->imsi, imsi, sizeof(gsub->imsi));
+ osmo_strlcpy(gsub->imsi, imsi, sizeof(gsub->imsi));
}
if (!gsub->sgsn_data)
diff --git a/openbsc/src/libbsc/bsc_subscriber.c b/openbsc/src/libbsc/bsc_subscriber.c
index a5e40cdba..73e61e801 100644
--- a/openbsc/src/libbsc/bsc_subscriber.c
+++ b/openbsc/src/libbsc/bsc_subscriber.c
@@ -80,7 +80,7 @@ void bsc_subscr_set_imsi(struct bsc_subscr *bsub, const char *imsi)
{
if (!bsub)
return;
- strncpy(bsub->imsi, imsi, sizeof(bsub->imsi));
+ osmo_strlcpy(bsub->imsi, imsi, sizeof(bsub->imsi));
}
struct bsc_subscr *bsc_subscr_find_or_create_by_imsi(struct llist_head *list,