Browse code

modules_k/presence Safety check for malformed Subscribe

Subscribe with header 'Contact: *' caused crash in presence.
(cherry picked from commit 41453eab823500cfc57abd404ecffeb3ed7f01bc)

Anca Vamanu authored on 25/04/2012 11:55:54
Showing 1 changed files
... ...
@@ -912,6 +912,12 @@ int extract_sdialog_info(subs_t* subs,struct sip_msg* msg, int mexp,
912 912
 		LM_ERR("cannot parse contact header\n");
913 913
 		goto error;
914 914
 	}
915
+	if(b->star || b->contacts==NULL)
916
+	{
917
+		LM_ERR("Wrong contact header\n");
918
+		goto error;
919
+	}
920
+
915 921
 	subs->contact = b->contacts->uri;
916 922
 	
917 923
 	LM_DBG("subs->contact= %.*s - len = %d\n",subs->contact.len,