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

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


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

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)

---

 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 87a8a13..eb31fce 100644
--- a/modules/topoh/topoh_mod.c
+++ b/modules/topoh/topoh_mod.c
@@ -211,7 +211,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))
 	{
@@ -293,7 +296,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