Parcourir la source

topoh: more safety checks for bad cseq

Daniel-Constantin Mierla il y a 14 ans
Parent
commit
7f9b429075
2 fichiers modifiés avec 9 ajouts et 3 suppressions
  1. 1 1
      modules/topoh/th_msg.c
  2. 8 2
      modules/topoh/topoh_mod.c

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

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