Skip to content

Commit

Permalink
core: make dst_uri null terminated
Browse files Browse the repository at this point in the history
(cherry picked from commit ca546d3)
  • Loading branch information
miconda committed Jan 8, 2020
1 parent dfdc591 commit 99f51cb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/core/parser/msg_parser.c
Expand Up @@ -749,7 +749,7 @@ int set_dst_uri(struct sip_msg* const msg, const str* const uri)
memcpy(msg->dst_uri.s, uri->s, uri->len);
msg->dst_uri.len = uri->len;
} else {
ptr = (char*)pkg_malloc(uri->len);
ptr = (char*)pkg_malloc(uri->len + 1);
if (!ptr) {
PKG_MEM_ERROR;
return -1;
Expand All @@ -759,6 +759,7 @@ int set_dst_uri(struct sip_msg* const msg, const str* const uri)
if (msg->dst_uri.s) pkg_free(msg->dst_uri.s);
msg->dst_uri.s = ptr;
msg->dst_uri.len = uri->len;
msg->dst_uri.s[msg->dst_uri.len] = '\0';
}
return 0;
}
Expand Down

0 comments on commit 99f51cb

Please sign in to comment.