Browse Source

topoh: safety check for SIP messages

- received callback can be executed for non-sip messages
- reported by Julia
Daniel-Constantin Mierla 12 years ago
parent
commit
352a7dccf2
1 changed files with 12 additions and 0 deletions
  1. 12 0
      modules/topoh/topoh_mod.c

+ 12 - 0
modules/topoh/topoh_mod.c

@@ -204,6 +204,18 @@ int th_prepare_msg(sip_msg_t *msg)
 		return 1;
 	}
 
+	if(msg->first_line.type==SIP_REQUEST)
+	{
+		if(!IS_SIP(msg))
+		{
+			LM_DBG("non sip request message\n");
+			return 1;
+		}
+	} else if(msg->first_line.type!=SIP_REPLY) {
+		LM_DBG("non sip message\n");
+		return 1;
+	}
+
 	if (parse_headers(msg, HDR_EOH_F, 0)==-1)
 	{
 		LM_DBG("parsing headers failed");