[sr-dev] git:master: uac: init avp_value lenght to be safe when avp is not found for restoring From/ To URI

Daniel-Constantin Mierla miconda at gmail.com
Mon Oct 13 11:36:13 CEST 2014


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Mon Oct 13 11:34:40 2014 +0200

uac: init avp_value lenght to be safe when avp is not found for restoring From/To URI

- reported by Klaus Darilion, FS#479

---

 modules/uac/replace.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/modules/uac/replace.c b/modules/uac/replace.c
index 83aa755..ccb2d46 100644
--- a/modules/uac/replace.c
+++ b/modules/uac/replace.c
@@ -671,7 +671,8 @@ static inline int restore_uri_reply(struct sip_msg *rpl,
 	char *p;
 
 	if(stored_value->len) {
-		LM_DBG("stored AVP value is '%.*s'with len '%d'\n",stored_value->len, stored_value->s,stored_value->len);
+		LM_DBG("stored AVP value is '%.*s'with len '%d'\n",
+				stored_value->len, stored_value->s, stored_value->len);
 		len=stored_value->len;
 		p = stored_value->s;
 	} else {
@@ -742,10 +743,9 @@ void restore_uris_reply(struct cell* t, int type, struct tmcb_params *p)
 			return;
 		}
 
+		avp_value.s.len=0;
 		if(restore_from_avp.s) {
 			search_first_avp(restore_from_avp_type, restore_from_avp_name, &avp_value,0);
-		} else {
-			avp_value.s.len=0;
 		}
 
 		if (restore_uri_reply( rpl, rpl->from, req->from, &avp_value.s)) {
@@ -762,10 +762,9 @@ void restore_uris_reply(struct cell* t, int type, struct tmcb_params *p)
 			return;
 		}
 
+		avp_value.s.len=0;
 		if(restore_to_avp.s) {
 			search_first_avp(restore_to_avp_type, restore_to_avp_name, &avp_value,0);
-		} else {
-			avp_value.s.len=0;
 		}
 
 		if (restore_uri_reply( rpl, rpl->to, req->to, &avp_value.s)) {




More information about the sr-dev mailing list