Skip to content

Commit

Permalink
ims_isc: null terminate dst_uri field
Browse files Browse the repository at this point in the history
(cherry picked from commit a8cc28b)
(cherry picked from commit 29ca123)
  • Loading branch information
miconda committed Jan 28, 2020
1 parent 180ab22 commit 4e75edb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/modules/ims_isc/isc.c
Expand Up @@ -66,13 +66,14 @@ int isc_forward(struct sip_msg *msg, isc_match *m, isc_mark *mark, int firstflag
/* change destination so it forwards to the app server */
if (msg->dst_uri.s)
pkg_free(msg->dst_uri.s);
msg->dst_uri.s = pkg_malloc(m->server_name.len);
msg->dst_uri.s = pkg_malloc(m->server_name.len + 1);
if (!msg->dst_uri.s) {
LM_ERR("error allocating %d bytes\n", m->server_name.len);
return ISC_RETURN_ERROR;
}
msg->dst_uri.len = m->server_name.len;
memcpy(msg->dst_uri.s, m->server_name.s, m->server_name.len);
msg->dst_uri.s[msg->dst_uri.len] = '\0';

/* append branch if last trigger failed */
if (is_route_type(FAILURE_ROUTE) && !firstflag)
Expand Down

0 comments on commit 4e75edb

Please sign in to comment.