mirror of https://github.com/sipwise/kamailio.git
After constructing the SIP URI, call parse_uri() to verify the result is well-formed before writing it to the output pvar. If validation fails, free the allocated pkg memory and return -1. Change-Id: I332c54640a76d3286c2c2ae029f90550bac199c7 (cherry picked from commitmr14.1.111d8e16180) (cherry picked from commit800b939948)
parent
31fef3f2ee
commit
3e03cf027c
@ -0,0 +1,42 @@
|
||||
--- a/src/modules/siputils/checks.c
|
||||
+++ b/src/modules/siputils/checks.c
|
||||
@@ -645,6 +645,7 @@ int tel2sip(struct sip_msg *_msg, char *
|
||||
int i, j, in_tel_parameters = 0;
|
||||
pv_spec_t *res;
|
||||
pv_value_t res_val;
|
||||
+ struct sip_uri parsed_check;
|
||||
|
||||
/* get parameters */
|
||||
if(get_str_fparam(&uri, _msg, (fparam_t *)_uri) < 0) {
|
||||
@@ -709,6 +710,11 @@ int tel2sip(struct sip_msg *_msg, char *
|
||||
/* tel_uri is not needed anymore */
|
||||
pkg_free(tel_uri.s);
|
||||
|
||||
+ if(parse_uri(sip_uri.s, sip_uri.len, &parsed_check) < 0) {
|
||||
+ pkg_free(sip_uri.s);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
/* set result pv value and write sip uri to result pv */
|
||||
res_val.rs = sip_uri;
|
||||
res_val.flags = PV_VAL_STR;
|
||||
@@ -823,6 +829,7 @@ int tel2sip2(struct sip_msg *_msg, char
|
||||
pv_value_t res_val;
|
||||
char *tmp_ptr = NULL;
|
||||
tel_param_t params[MAX_TEL_PARAMS];
|
||||
+ struct sip_uri parsed_check;
|
||||
|
||||
/* get parameters */
|
||||
if(get_str_fparam(&uri, _msg, (fparam_t *)_uri) < 0) {
|
||||
@@ -935,6 +942,11 @@ int tel2sip2(struct sip_msg *_msg, char
|
||||
/* tel_uri is not needed anymore */
|
||||
pkg_free(tel_uri.s);
|
||||
|
||||
+ if(parse_uri(sip_uri.s, sip_uri.len, &parsed_check) < 0) {
|
||||
+ pkg_free(sip_uri.s);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
sip_uri.len = strlen(sip_uri.s);
|
||||
|
||||
/* set result pv value and write sip uri to result pv */
|
||||
Loading…
Reference in new issue