Jelajahi Sumber

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

(cherry picked from commit 5e5866b2ac8390caa9373f49345ed877c6e5f037)
Daniel-Constantin Mierla 10 tahun lalu
induk
melakukan
fd6dba3b97
1 mengubah file dengan 5 tambahan dan 0 penghapusan
  1. 5 0
      modules/regex/regex_mod.c

+ 5 - 0
modules/regex/regex_mod.c

@@ -354,6 +354,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++) {