[sr-dev] git:master: topoh: more safety checks for bad cseq

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


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

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

---

 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 5f87971..a721141 100644
--- a/modules/topoh/th_msg.c
+++ b/modules/topoh/th_msg.c
@@ -1040,7 +1040,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 bc7ea8e..ba312b0 100644
--- a/modules/topoh/topoh_mod.c
+++ b/modules/topoh/topoh_mod.c
@@ -231,7 +231,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))
 	{
@@ -324,7 +327,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