Change in osmo-msc[master]: silent_call: use osmo_strlcpy() instead of strncpy()

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Fri Mar 15 20:08:20 UTC 2019


Pau Espin Pedrol has submitted this change and it was merged. ( https://gerrit.osmocom.org/13261 )

Change subject: silent_call: use osmo_strlcpy() instead of strncpy()
......................................................................

silent_call: use osmo_strlcpy() instead of strncpy()

If gsm_silent_call_start() is called with an over long string in
traffic_dst_ip, then the target string might be left unterminated. Lets
use osmo_strlcpy() so that we can be sure the result in scd->traffic_ip
is always terminated.

Fixes: CID#196068
Change-Id: Ic81842175e412ae7d97d023b612412f33411d60c
---
M src/libmsc/silent_call.c
1 file changed, 2 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  Max: Looks good to me, but someone else must approve
  Pau Espin Pedrol: Looks good to me, approved



diff --git a/src/libmsc/silent_call.c b/src/libmsc/silent_call.c
index 7effba3..14974f3 100644
--- a/src/libmsc/silent_call.c
+++ b/src/libmsc/silent_call.c
@@ -26,6 +26,7 @@
 
 #include <osmocom/core/byteswap.h>
 #include <osmocom/core/msgb.h>
+#include <osmocom/core/utils.h>
 #include <osmocom/msc/signal.h>
 #include <osmocom/msc/debug.h>
 #include <osmocom/msc/gsm_data.h>
@@ -202,7 +203,7 @@
 	memcpy(&scd->ct, ct, sizeof(scd->ct));
 
 	if (traffic_dst_ip) {
-		strncpy(scd->traffic_ip, traffic_dst_ip, sizeof(scd->traffic_ip));
+		osmo_strlcpy(scd->traffic_ip, traffic_dst_ip, sizeof(scd->traffic_ip));
 		scd->traffic_port = traffic_dst_port;
 	}
 

-- 
To view, visit https://gerrit.osmocom.org/13261
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic81842175e412ae7d97d023b612412f33411d60c
Gerrit-Change-Number: 13261
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190315/76e37a3f/attachment.html>


More information about the gerrit-log mailing list