aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2019-03-15 09:43:40 +0100
committerPhilipp Maier <pmaier@sysmocom.de>2019-03-15 09:51:15 +0100
commit9286114f6f9a8b45e620ccf2014ed713c770c9ed (patch)
treefde728cebf1ccc74f6c0cb5f19317fb8c9357343
parent935583069d3d79ba93640df2e9287acdf8c50fe1 (diff)
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
-rw-r--r--src/libmsc/silent_call.c3
1 files changed, 2 insertions, 1 deletions
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 @@ int gsm_silent_call_start(struct vlr_subscr *vsub,
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;
}