[sr-dev] git:3.1: kcore: check if To header is parsed before parsing To uri

Daniel-Constantin Mierla miconda at gmail.com
Sat Mar 26 14:32:17 CET 2011


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Sat Mar 26 14:22:38 2011 +0100

kcore: check if To header is parsed before parsing To uri

- parse_to_uri(msg) calls parse_to_header(msg) in order to be sure that
  the To header has been located and parsed
(cherry picked from commit fa2e51a07ce6175697fd22a41a28cbbb4fa4270b)

---

 lib/kcore/parser_helpers.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/lib/kcore/parser_helpers.c b/lib/kcore/parser_helpers.c
index 37aa4fa..66017ec 100644
--- a/lib/kcore/parser_helpers.c
+++ b/lib/kcore/parser_helpers.c
@@ -12,7 +12,16 @@ struct sip_uri *parse_to_uri(struct sip_msg *msg)
 {
 	struct to_body *tb = NULL;
 	
-	if(msg==NULL || msg->to==NULL || msg->to->parsed==NULL)
+	if(msg==NULL)
+		return NULL;
+
+	if(parse_to_header(msg)<0)
+	{
+		LM_ERR("cannot parse TO header\n");
+		return NULL;
+	}
+
+	if(msg->to==NULL || get_to(msg)==NULL)
 		return NULL;
 
 	tb = get_to(msg);




More information about the sr-dev mailing list