[SR-Dev] git:master: fix k bug #2790184, crash related to uninitialized match_callid parameter

Henning Westerholt henning.westerholt at 1und1.de
Wed May 13 13:10:15 CEST 2009


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

Author: Henning Westerholt <henning.westerholt at 1und1.de>
Committer: Henning Westerholt <henning.westerholt at 1und1.de>
Date:   Wed May 13 13:03:30 2009 +0200

fix k bug #2790184, crash related to uninitialized match_callid parameter

- reported from Inaki, port from kamailio r5835

---

 modules_k/registrar/lookup.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/modules_k/registrar/lookup.c b/modules_k/registrar/lookup.c
index 5dcc924..2f5644f 100644
--- a/modules_k/registrar/lookup.c
+++ b/modules_k/registrar/lookup.c
@@ -179,6 +179,7 @@ int registered(struct sip_msg* _m, char* _t, char* _s)
 	urecord_t* r;
 	ucontact_t* ptr;
 	int res;
+	int_str match_callid;
 
 	if (_m->new_uri.s) uri = _m->new_uri;
 	else uri = _m->first_line.u.request.uri;
@@ -199,12 +200,15 @@ int registered(struct sip_msg* _m, char* _t, char* _s)
 
 	if (res == 0) {
 		
-		int_str match_callid;
 		if (reg_callid_avp_name.n) {
 			struct usr_avp *avp =
 				search_first_avp( reg_callid_avp_type, reg_callid_avp_name, &match_callid, 0);
 			if (!(avp && is_avp_str_val(avp)))
-				match_callid=(int_str)0;
+				match_callid.n = 0;
+				match_callid.s.s = NULL;
+		} else {
+			match_callid.n = 0;
+			match_callid.s.s = NULL;
 		}
 
 		for (ptr = r->contacts; ptr; ptr = ptr->next) {




More information about the sr-dev mailing list