[MERGED] 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
Sat Nov 26 13:03:31 UTC 2016


Harald Welte has submitted this change and it was merged.

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


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(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



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: merged
Gerrit-Change-Id: I152e84206e0b2b80fa79956f5adbbe84ff10b4ab
Gerrit-PatchSet: 1
Gerrit-Project: osmo-iuh
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list