浏览代码

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

Daniel-Constantin Mierla 10 年之前
父节点
当前提交
5e5866b2ac
共有 1 个文件被更改,包括 5 次插入0 次删除
  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++) {