[sr-dev] git:master: ims_registrar_pcscf: Safety check, if (r) is set ( caused a crash)

Carsten Bock carsten at ng-voice.com
Thu Sep 11 12:19:55 CEST 2014


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

Author: Carsten Bock <carsten at ng-voice.com>
Committer: Carsten Bock <carsten at ng-voice.com>
Date:   Thu Sep 11 12:19:18 2014 +0200

ims_registrar_pcscf: Safety check, if (r) is set (caused a crash)

---

 modules/ims_registrar_pcscf/service_routes.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/modules/ims_registrar_pcscf/service_routes.c b/modules/ims_registrar_pcscf/service_routes.c
index 851ffad..1eef7f4 100644
--- a/modules/ims_registrar_pcscf/service_routes.c
+++ b/modules/ims_registrar_pcscf/service_routes.c
@@ -297,7 +297,7 @@ int check_service_routes(struct sip_msg* _m, udomain_t* _d) {
 		if (r) {
 			LM_DBG("Route is %.*s\n", r->nameaddr.uri.len, r->nameaddr.uri.s);
 			/* Skip first headers containing myself: */
-			while (parse_uri(r->nameaddr.uri.s, r->nameaddr.uri.len, &uri) == 0
+			while (r && (parse_uri(r->nameaddr.uri.s, r->nameaddr.uri.len, &uri) == 0)
 			  && check_self(&uri.host,uri.port_no?uri.port_no:SIP_PORT,0)) {
 				LM_DBG("Self\n");
 				/* Check for more headers and fail, if it was the last one
@@ -315,6 +315,7 @@ int check_service_routes(struct sip_msg* _m, udomain_t* _d) {
 				if (r)
 					LM_DBG("Next Route is %.*s\n", r->nameaddr.uri.len, r->nameaddr.uri.s);
 			}
+			LM_DBG("We have %d service-routes\n");
 			/* Then check the following headers: */
 			for (i=0; i< c->num_service_routes; i++) {
 				LM_DBG("Route must be: %.*s\n", c->service_routes[i].len, c->service_routes[i].s);




More information about the sr-dev mailing list