Module: kamailio
Branch: master
Commit: 4b11820cb4337718854f1b80963e204764bc23b1
URL:
https://github.com/kamailio/kamailio/commit/4b11820cb4337718854f1b80963e204…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-11-20T13:27:33+01:00
rtpproxy: print the ip address directly to local buffer
- avoid extra copy
---
Modified: src/modules/rtpproxy/rtpproxy.c
---
Diff:
https://github.com/kamailio/kamailio/commit/4b11820cb4337718854f1b80963e204…
Patch:
https://github.com/kamailio/kamailio/commit/4b11820cb4337718854f1b80963e204…
---
diff --git a/src/modules/rtpproxy/rtpproxy.c b/src/modules/rtpproxy/rtpproxy.c
index 74da691e705..f6ea6b1b12d 100644
--- a/src/modules/rtpproxy/rtpproxy.c
+++ b/src/modules/rtpproxy/rtpproxy.c
@@ -1815,11 +1815,11 @@ static int rtpproxy_manage2(struct sip_msg *msg, char *flags, char
*ip)
static int rtpproxy_offer1_helper_f(struct sip_msg *msg, char *flags)
{
- char *cp;
char newip[IP_ADDR_MAX_STR_SIZE];
+ int len;
- cp = ip_addr2a(&msg->rcv.dst_ip);
- strcpy(newip, cp);
+ len = ip_addr2sbuf(&msg->rcv.dst_ip, newip, IP_ADDR_MAX_STR_SIZE - 1);
+ newip[len] = 0;
return force_rtp_proxy(msg, flags, newip, 1, 0);
}