Răsfoiți Sursa

regex: safety to check to avoid working with zero size allocations

Daniel-Constantin Mierla 10 ani în urmă
părinte
comite
5e5866b2ac
1 a modificat fișierele cu 5 adăugiri și 0 ștergeri
  1. 5 0
      modules/regex/regex_mod.c

+ 5 - 0
modules/regex/regex_mod.c

@@ -347,6 +347,11 @@ static int load_pcres(int action)
 	
 	fclose(f);
 	
+	if(num_pcres_tmp==0) {
+		LM_ERR("no expressions in the file\n");
+		goto err;
+	}
+
 	/* Fix the patterns */
 	for (i=0; i < num_pcres_tmp; i++) {