[sr-dev] git:kamailio_3.0: topoh: more safety checks for bad cseq

Daniel-Constantin Mierla miconda at gmail.com
Fri Feb 4 18:29:36 CET 2011


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Fri Feb  4 18:26:37 2011 +0100

topoh: more safety checks for bad cseq
(cherry picked from commit 7f9b429075fa870b6bfdc4fc1a08c396f6c8eeb5)
(cherry picked from commit eb969ad69d341a851e9ee89c73c5006237329f04)

---

 modules/topoh/th_msg.c    |    2 +-
 modules/topoh/topoh_mod.c |   10 ++++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/modules/topoh/th_msg.c b/modules/topoh/th_msg.c
index b430e25..237c7c8 100644
--- a/modules/topoh/th_msg.c
+++ b/modules/topoh/th_msg.c
@@ -1033,7 +1033,7 @@ int th_route_direction(sip_msg_t *msg)
 
 int th_skip_msg(sip_msg_t *msg)
 {
-	if (!get_cseq(msg)) {
+	if (msg->cseq==NULL || get_cseq(msg)==NULL) {
 		LM_WARN("Invalid/Unparsed CSeq in message. Skipping.");
 		return 1;
 	}
diff --git a/modules/topoh/topoh_mod.c b/modules/topoh/topoh_mod.c
index 8146cbe..850b8be 100644
--- a/modules/topoh/topoh_mod.c
+++ b/modules/topoh/topoh_mod.c
@@ -178,7 +178,10 @@ int th_msg_received(void *data)
 	msg.buf = obuf->s;
 	msg.len = obuf->len;
 
-	th_prepare_msg(&msg);
+	if(th_prepare_msg(&msg)!=0)
+	{
+		goto done;
+	}
 
 	if(th_skip_msg(&msg))
 	{
@@ -260,7 +263,10 @@ int th_msg_sent(void *data)
 	msg.buf = obuf->s;
 	msg.len = obuf->len;
 
-	th_prepare_msg(&msg);
+	if(th_prepare_msg(&msg)!=0)
+	{
+		goto done;
+	}
 
 	if(th_skip_msg(&msg))
 	{




More information about the sr-dev mailing list