[sr-dev] git:master: modules/path: unescaped received param value also in path rr callback

Juha Heinanen jh at tutpro.com
Thu Apr 11 08:32:59 CEST 2013


Module: sip-router
Branch: master
Commit: 1a22767e39d50af450a49256b4425503a2d0d388
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=1a22767e39d50af450a49256b4425503a2d0d388

Author: Juha Heinanen <jh at tutpro.com>
Committer: Juha Heinanen <jh at tutpro.com>
Date:   Thu Apr 11 09:31:37 2013 +0300

modules/path: unescaped received param value also in path rr callback

---

 modules/path/Makefile |    3 +++
 modules/path/path.c   |   12 +++++++++++-
 2 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/modules/path/Makefile b/modules/path/Makefile
index a9aa7f1..26d784f 100644
--- a/modules/path/Makefile
+++ b/modules/path/Makefile
@@ -12,4 +12,7 @@ LIBS=
 
 DEFS+=-DKAMAILIO_MOD_INTERFACE
 
+SERLIBPATH=../../lib
+SER_LIBS+=$(SERLIBPATH)/kcore/kcore
+
 include ../../Makefile.modules
diff --git a/modules/path/path.c b/modules/path/path.c
index b38207f..122d7fa 100644
--- a/modules/path/path.c
+++ b/modules/path/path.c
@@ -36,6 +36,7 @@
 #include "../../mem/mem.h"
 #include "../../data_lump.h"
 #include "../../parser/parse_param.h"
+#include "../../lib/kcore/strcommon.h"
 #include "../../dset.h"
 
 #include "path.h"
@@ -257,6 +258,8 @@ void path_rr_callback(struct sip_msg *_m, str *r_param, void *cb_param)
 {
 	param_hooks_t hooks;
 	param_t *params;
+	static char dst_uri_buf[MAX_URI_SIZE];
+	static str dst_uri;
 			
 	if (parse_params(r_param, CLASS_CONTACT, &hooks, &params) != 0) {
 		LM_ERR("failed to parse route parameters\n");
@@ -264,7 +267,14 @@ void path_rr_callback(struct sip_msg *_m, str *r_param, void *cb_param)
 	}
 
 	if (hooks.contact.received) {
-		if (set_dst_uri(_m, &hooks.contact.received->body) != 0) {
+	        dst_uri.s = dst_uri_buf;
+		dst_uri.len = MAX_URI_SIZE;
+		if (unescape_user(&(hooks.contact.received->body), &dst_uri) < 0) {
+		        LM_ERR("unescaping received failed\n");
+			free_params(params);
+			return;
+		}	    
+		if (set_dst_uri(_m, &dst_uri) != 0) {
 			LM_ERR("failed to set dst-uri\n");
 			free_params(params);
 			return;




More information about the sr-dev mailing list