Browse Source

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

Daniel-Constantin Mierla 14 years ago
parent
commit
f7de24173f
2 changed files with 9 additions and 3 deletions
  1. 1 1
      modules/topoh/th_msg.c
  2. 8 2
      modules/topoh/topoh_mod.c

+ 1 - 1
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;
 	}

+ 8 - 2
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))
 	{