client: use osmo_strlcpy instead of strncpy
simplify \nul termination of the ip_addr string
Change-Id: I94e3815f45d08e0d40faf41e580547de937c4ce8
diff --git a/src/libosmo-mgcp/mgcp_network.c b/src/libosmo-mgcp/mgcp_network.c
index a02b0d1..816f16b 100644
--- a/src/libosmo-mgcp/mgcp_network.c
+++ b/src/libosmo-mgcp/mgcp_network.c
@@ -88,7 +88,7 @@
if (endp->cfg->net_ports.bind_addr) {
/* Check there is a bind IP for the RTP traffic configured,
* if so, use that IP-Address */
- strncpy(addr, endp->cfg->net_ports.bind_addr, INET_ADDRSTRLEN);
+ osmo_strlcpy(addr, endp->cfg->net_ports.bind_addr, INET_ADDRSTRLEN);
LOGP(DRTP, LOGL_DEBUG,
"endpoint:%x CI:%s using configured rtp bind ip as local bind ip %s\n",
ENDPOINT_NUMBER(endp), conn->conn->id, addr);
@@ -96,7 +96,7 @@
/* No specific bind IP is configured for the RTP traffic, so
* assume the IP where we listen for incoming MGCP messages
* as bind IP */
- strncpy(addr, endp->cfg->source_addr, INET_ADDRSTRLEN);
+ osmo_strlcpy(addr, endp->cfg->source_addr, INET_ADDRSTRLEN);
LOGP(DRTP, LOGL_DEBUG,
"endpoint:%x CI:%s using mgcp bind ip as local rtp bind ip: %s\n",
ENDPOINT_NUMBER(endp), conn->conn->id, addr);