Module: kamailio
Branch: master
Commit: a8be2459fc4013060944bf79e7c66b3613e8d04c
URL:
https://github.com/kamailio/kamailio/commit/a8be2459fc4013060944bf79e7c66b3…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2019-11-20T19:30:44+01:00
ims_ipsec_pcscf: null terminate dst_uri fields
---
Modified: src/modules/ims_ipsec_pcscf/cmd.c
---
Diff:
https://github.com/kamailio/kamailio/commit/a8be2459fc4013060944bf79e7c66b3…
Patch:
https://github.com/kamailio/kamailio/commit/a8be2459fc4013060944bf79e7c66b3…
---
diff --git a/src/modules/ims_ipsec_pcscf/cmd.c b/src/modules/ims_ipsec_pcscf/cmd.c
index 11673582ad..b72d57a0ad 100644
--- a/src/modules/ims_ipsec_pcscf/cmd.c
+++ b/src/modules/ims_ipsec_pcscf/cmd.c
@@ -753,13 +753,14 @@ int ipsec_forward(struct sip_msg* m, udomain_t* d)
int buf_len = snprintf(buf, sizeof(buf) - 1, "sip:%.*s:%d",
ci.via_host.len, ci.via_host.s, dst_port);
- if((m->dst_uri.s = pkg_malloc(buf_len)) == NULL) {
+ if((m->dst_uri.s = pkg_malloc(buf_len + 1)) == NULL) {
LM_ERR("Error allocating memory for dst_uri\n");
goto cleanup;
}
memcpy(m->dst_uri.s, buf, buf_len);
m->dst_uri.len = buf_len;
+ m->dst_uri.s[m->dst_uri.len] = '\0';
// Set send socket
struct socket_info * client_sock = grep_sock_info(via_host.af == AF_INET ?
&ipsec_listen_addr : &ipsec_listen_addr6, src_port, dst_proto);