Skip to content

Commit

Permalink
rls: allocate size for normalized uri for cloning buffer
Browse files Browse the repository at this point in the history
- it can be longer than pres uri, when proto prefix needs to be added
  • Loading branch information
miconda committed May 27, 2018
1 parent b035558 commit 93932a4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/modules/rls/subscribe.c
Expand Up @@ -978,6 +978,8 @@ int send_resource_subs(char* uri, void* param)
pres_uri.len, pres_uri.s);
return -1;
}
LM_DBG("pres uri [%.*s] - normalized uri [%.*s]\n",
pres_uri.len, pres_uri.s, normalized_uri->len, normalized_uri->s);

if (parse_uri(normalized_uri->s, normalized_uri->len, &parsed_pres_uri)
< 0) {
Expand Down Expand Up @@ -1009,7 +1011,8 @@ int send_resource_subs(char* uri, void* param)
LM_ERR("out of private memory\n");
return -1;
}
if ((tmp_str->s = (char *)pkg_malloc(sizeof(char) * pres_uri.len)) == NULL)
if ((tmp_str->s = (char *)pkg_malloc(sizeof(char)
* normalized_uri->len)) == NULL)
{
pkg_free(tmp_str);
LM_ERR("out of private memory\n");
Expand Down

0 comments on commit 93932a4

Please sign in to comment.