[MERGED] osmo-sip-connector[master]: mncc.c: Ensure proper string buffer NUL 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
Tue Nov 7 20:55:13 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: mncc.c: Ensure proper string buffer NUL termination
......................................................................


mncc.c: Ensure proper string buffer NUL termination

Change-Id: I2f58a495f60ed744c1f625dc8df56aa4dc0aa4cb
Fixes: Coverity CID#92223
---
M src/mncc.c
1 file changed, 2 insertions(+), 2 deletions(-)

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



diff --git a/src/mncc.c b/src/mncc.c
index 669a80c..45c062f 100644
--- a/src/mncc.c
+++ b/src/mncc.c
@@ -738,7 +738,7 @@
 	mncc.fields |= MNCC_F_CALLING;
 	mncc.calling.plan = 1;
 	mncc.calling.type = 0x0;
-	strncpy(mncc.calling.number, call->source, sizeof(mncc.calling.number));
+	osmo_strlcpy(mncc.calling.number, call->source, sizeof(mncc.calling.number));
 
 	if (conn->app->use_imsi_as_id) {
 		snprintf(mncc.imsi, 15, "%s", call->dest);
@@ -746,7 +746,7 @@
 		mncc.fields |= MNCC_F_CALLED;
 		mncc.called.plan = 1;
 		mncc.called.type = 0x0;
-		strncpy(mncc.called.number, call->dest, sizeof(mncc.called.number));
+		osmo_strlcpy(mncc.called.number, call->dest, sizeof(mncc.called.number));
 	}
 
 	/*

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I2f58a495f60ed744c1f625dc8df56aa4dc0aa4cb
Gerrit-PatchSet: 2
Gerrit-Project: osmo-sip-connector
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