[PATCH] openbsc[master]: bsc_/gprs_subscriber: fix: use osmo_strlcpy() to safely copy...

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Wed Mar 8 17:36:20 UTC 2017


Review at  https://gerrit.osmocom.org/2017

bsc_/gprs_subscriber: fix: use osmo_strlcpy() to safely copy IMSI

Fixes: coverity scan CID 163918
Change-Id: I4b2760b006a0707928530b4390c6997b79b02981
---
M openbsc/src/gprs/gprs_subscriber.c
M openbsc/src/libbsc/bsc_subscriber.c
2 files changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/17/2017/1

diff --git a/openbsc/src/gprs/gprs_subscriber.c b/openbsc/src/gprs/gprs_subscriber.c
index 2042ec6..1bb5141 100644
--- a/openbsc/src/gprs/gprs_subscriber.c
+++ b/openbsc/src/gprs/gprs_subscriber.c
@@ -157,7 +157,7 @@
 		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 a5e40cd..73e61e8 100644
--- a/openbsc/src/libbsc/bsc_subscriber.c
+++ b/openbsc/src/libbsc/bsc_subscriber.c
@@ -80,7 +80,7 @@
 {
 	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,

-- 
To view, visit https://gerrit.osmocom.org/2017
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4b2760b006a0707928530b4390c6997b79b02981
Gerrit-PatchSet: 1
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list