Browse code

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

(cherry picked from commit 5e5866b2ac8390caa9373f49345ed877c6e5f037)

Daniel-Constantin Mierla authored on 14/05/2015 12:36:24
Showing 1 changed files
... ...
@@ -354,6 +354,11 @@ static int load_pcres(int action)
354 354
 	
355 355
 	fclose(f);
356 356
 	
357
+	if(num_pcres_tmp==0) {
358
+		LM_ERR("no expressions in the file\n");
359
+		goto err;
360
+	}
361
+
357 362
 	/* Fix the patterns */
358 363
 	for (i=0; i < num_pcres_tmp; i++) {
359 364