summaryrefslogtreecommitdiffstats
path: root/openbsc/src/libtrau
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-01-13 03:12:08 +0100
committerHarald Welte <laforge@gnumonks.org>2017-01-23 11:59:01 +0000
commit93bafb611a58293e0353320a14db298133c9d99a (patch)
tree4ba6d276b7f5e2fda43f21b765d7cca8c6b00d5e /openbsc/src/libtrau
parent59504dc80fe8c0d9a18994d82586a550c7efa341 (diff)
cosmetic: use osmo_strlcpy() everywhere
Shorten some code and make obvious to the reader that the string copy is done in a safe way. Change-Id: I900726cf06d34128db22a3d3d911ee0d1423b1bd
Diffstat (limited to 'openbsc/src/libtrau')
-rw-r--r--openbsc/src/libtrau/rtp_proxy.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/openbsc/src/libtrau/rtp_proxy.c b/openbsc/src/libtrau/rtp_proxy.c
index ed1917512..6b38ee5fe 100644
--- a/openbsc/src/libtrau/rtp_proxy.c
+++ b/openbsc/src/libtrau/rtp_proxy.c
@@ -29,6 +29,7 @@
#include <sys/utsname.h> /* uname() */
#include <osmocom/core/talloc.h>
+#include <osmocom/core/utils.h>
#include <openbsc/gsm_data.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/select.h>
@@ -368,9 +369,9 @@ static int rtcp_mangle(struct msgb *msg, struct rtp_socket *rs)
}
if (rtph->type == RTCP_TYPE_SDES) {
char new_cname[255];
- strncpy(new_cname, inet_ntoa(rss->sin_local.sin_addr),
- sizeof(new_cname));
- new_cname[sizeof(new_cname)-1] = '\0';
+ osmo_strlcpy(new_cname,
+ inet_ntoa(rss->sin_local.sin_addr),
+ sizeof(new_cname));
rc = rtcp_sdes_cname_mangle(msg, rtph, &old_len,
new_cname);
if (rc < 0)