Module: kamailio Branch: 4.2 Commit: fd6dba3b9752e9cbf21da2ca7b66b2e5c1dafce7 URL: https://github.com/kamailio/kamailio/commit/fd6dba3b9752e9cbf21da2ca7b66b2e5...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2015-05-19T09:34:50+02:00
regex: safety to check to avoid working with zero size allocations
(cherry picked from commit 5e5866b2ac8390caa9373f49345ed877c6e5f037)
---
Modified: modules/regex/regex_mod.c
---
Diff: https://github.com/kamailio/kamailio/commit/fd6dba3b9752e9cbf21da2ca7b66b2e5... Patch: https://github.com/kamailio/kamailio/commit/fd6dba3b9752e9cbf21da2ca7b66b2e5...
---
diff --git a/modules/regex/regex_mod.c b/modules/regex/regex_mod.c index 5b8b5cc..4f714b5 100644 --- a/modules/regex/regex_mod.c +++ b/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++) {