Module: kamailio
Branch: 5.3
Commit: 9c6b822b4e9b297c497cec241b257a177ca804b1
URL:
https://github.com/kamailio/kamailio/commit/9c6b822b4e9b297c497cec241b257a1…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Ovidiu Sas <osas(a)voipembedded.com>
Date: 2021-03-16T15:54:51-04:00
siputils: 0-ending value on deconding uri
(cherry picked from commit 735911fcced21eb5c66393045bc143bd953d08bb)
---
Modified: src/modules/siputils/contact_ops.c
---
Diff:
https://github.com/kamailio/kamailio/commit/9c6b822b4e9b297c497cec241b257a1…
Patch:
https://github.com/kamailio/kamailio/commit/9c6b822b4e9b297c497cec241b257a1…
---
diff --git a/src/modules/siputils/contact_ops.c b/src/modules/siputils/contact_ops.c
index 427bf3bb13..20c76efdd6 100644
--- a/src/modules/siputils/contact_ops.c
+++ b/src/modules/siputils/contact_ops.c
@@ -163,12 +163,14 @@ int ki_decode_contact(sip_msg_t *msg)
return res;
} else {
/* we do not modify the original first line */
- if((msg->new_uri.s == NULL) || (msg->new_uri.len == 0))
+ if((msg->new_uri.s == NULL) || (msg->new_uri.len == 0)) {
msg->new_uri = newUri;
- else {
+ } else {
pkg_free(msg->new_uri.s);
msg->new_uri = newUri;
}
+ msg->parsed_uri_ok=0;
+ ruri_mark_new();
}
return 1;
}
@@ -575,7 +577,7 @@ int decode_uri(str uri, char separator, str *result)
uri.len);
/* adding one comes from * */
- result->s = pkg_malloc(result->len);
+ result->s = pkg_malloc(result->len + 1); /* NULL termination */
if(result->s == NULL) {
LM_ERR("unable to allocate pkg memory\n");
return -4;
@@ -624,6 +626,7 @@ int decode_uri(str uri, char separator, str *result)
memcpy(pos, uri.s + format.second, uri.len - format.second); /* till end: */
+ result->s[result->len] = '\0';
LM_DBG("New decoded uri [%.*s]\n", result->len, result->s);
return 0;