[sr-dev] git:3.1: core: check for empty port values

Daniel-Constantin Mierla miconda at gmail.com
Tue Feb 8 12:52:42 CET 2011


Module: sip-router
Branch: 3.1
Commit: 68a3740e3f9fcabd944d295f2e6e03cda172e5e9
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=68a3740e3f9fcabd944d295f2e6e03cda172e5e9

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Sat Jan 29 03:11:46 2011 +0100

core: check for empty port values

- if setport has empty string parameter skip adding ':'
(cherry picked from commit d260b2cba84e1699fe9b2c0860de91e018e03bca)

---

 action.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/action.c b/action.c
index 67c6026..e72dd46 100644
--- a/action.c
+++ b/action.c
@@ -990,8 +990,10 @@ int do_action(struct run_act_ctx* h, struct action* a, struct sip_msg* msg)
 					tmp=0;
 				else if (a->type==SET_PORT_T) {
 					tmp=a->val[0].u.string;
-					if (tmp) len = strlen(tmp);
-					else len = 0;
+					if (tmp) {
+						len = strlen(tmp);
+						if(len==0) tmp = 0;
+					} else len = 0;
 				} else {
 					tmp=uri.port.s;
 					len = uri.port.len;




More information about the sr-dev mailing list