[PATCH] osmo-iuh[master]: ue_context_alloc(): Avoid ue->imsi without NULL termination

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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Fri Nov 25 23:04:51 UTC 2016


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

ue_context_alloc(): Avoid ue->imsi without NULL termination

Change-Id: I152e84206e0b2b80fa79956f5adbbe84ff10b4ab
Fixes: Coverity CID 57625
---
M src/hnbgw.c
1 file changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-iuh refs/changes/81/1281/1

diff --git a/src/hnbgw.c b/src/hnbgw.c
index acca643..9984927 100644
--- a/src/hnbgw.c
+++ b/src/hnbgw.c
@@ -163,9 +163,10 @@
 		return NULL;
 
 	ue->hnb = hnb;
-	if (imsi)
+	if (imsi) {
 		strncpy(ue->imsi, imsi, sizeof(ue->imsi));
-	else
+		ue->imsi[sizeof(ue->imsi)-1] = '\0';
+	} else
 		ue->imsi[0] = '\0';
 	ue->tmsi = tmsi;
 	ue->context_id = get_next_ue_ctx_id(hnb->gw);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I152e84206e0b2b80fa79956f5adbbe84ff10b4ab
Gerrit-PatchSet: 1
Gerrit-Project: osmo-iuh
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>



More information about the gerrit-log mailing list