Module: kamailio
Branch: master
Commit: 916c56df9f8c633ba4c4d4a173e35eea8c23a343
URL:
https://github.com/kamailio/kamailio/commit/916c56df9f8c633ba4c4d4a173e35ee…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-06-17T08:20:52+02:00
siputils: use rewrite_uri() to update decoded r-uri
---
Modified: src/modules/siputils/contact_ops.c
---
Diff:
https://github.com/kamailio/kamailio/commit/916c56df9f8c633ba4c4d4a173e35ee…
Patch:
https://github.com/kamailio/kamailio/commit/916c56df9f8c633ba4c4d4a173e35ee…
---
diff --git a/src/modules/siputils/contact_ops.c b/src/modules/siputils/contact_ops.c
index 796656ea52..a299db32e5 100644
--- a/src/modules/siputils/contact_ops.c
+++ b/src/modules/siputils/contact_ops.c
@@ -902,26 +902,13 @@ int ki_contact_param_decode_ruri(sip_msg_t *msg, str *nparam)
LM_ERR("failed to decode uri [%.*s]\n", uri.len, uri.s);
return -1;
}
- nval.s = (char*)pkg_malloc((nval.len+1)*sizeof(char));
- if(nval.s==NULL) {
- free_params(params);
- PKG_MEM_ERROR;
- return -1;
- }
- memcpy(nval.s, bnval, nval.len);
- nval.s[nval.len] = '\0';
+ nval.s = bnval;
+ free_params(params);
LM_DBG("decoded new uri [%.*s] (%d)\n", nval.len, nval.s, nval.len);
-
- if((msg->new_uri.s == NULL) || (msg->new_uri.len == 0)) {
- msg->new_uri = nval;
- } else {
- pkg_free(msg->new_uri.s);
- msg->new_uri = nval;
+ if(rewrite_uri(msg, &nval) < 0) {
+ return -1;
}
- ruri_mark_new(); /* re-use uri for serial forking */
-
- free_params(params);
return 1;
}