Browse Source

topoh: safety check for missing To header

- based on a patch by Michel de Weerd, FS#303

(cherry picked from commit 362d374a61953aee3cf9f96eadaef63c5f22763e)
Daniel-Constantin Mierla 12 years ago
parent
commit
d8739609c8
1 changed files with 7 additions and 1 deletions
  1. 7 1
      modules/topoh/topoh_mod.c

+ 7 - 1
modules/topoh/topoh_mod.c

@@ -228,12 +228,18 @@ int th_prepare_msg(sip_msg_t *msg)
 		return 3;
 	}
 
-	if(get_to(msg)==NULL)
+	if(parse_to_header(msg)<0 || msg->to==NULL)
 	{
 		LM_ERR("cannot parse TO header\n");
 		return 3;
 	}
 
+	if(get_to(msg)==NULL)
+	{
+		LM_ERR("cannot get TO header\n");
+		return 3;
+	}
+
 	return 0;
 }