Module: kamailio Branch: master Commit: 198b116b0d58e61d9c35fdd0988ce97192b8f61e URL: https://github.com/kamailio/kamailio/commit/198b116b0d58e61d9c35fdd0988ce971...
Author: Dmitri Savolainen savolainen@erinaco.ru Committer: Dmitri Savolainen savolainen@erinaco.ru Date: 2016-07-10T17:37:51+03:00
core: fix regex error for modules parameters
Ambiguous was possible in params for multiple modules in one config line.
---
Modified: modparam.c
---
Diff: https://github.com/kamailio/kamailio/commit/198b116b0d58e61d9c35fdd0988ce971... Patch: https://github.com/kamailio/kamailio/commit/198b116b0d58e61d9c35fdd0988ce971...
---
diff --git a/modparam.c b/modparam.c index 087f11e..851a5ce 100644 --- a/modparam.c +++ b/modparam.c @@ -59,15 +59,17 @@ int set_mod_param_regex(char* regex, char* name, modparam_t type, void* val) }
len = strlen(regex); - reg = pkg_malloc(len + 2 + 1); + reg = pkg_malloc(len + 4 + 1); if (reg == 0) { LM_ERR("No memory left\n"); return -1; } reg[0] = '^'; - memcpy(reg + 1, regex, len); - reg[len + 1] = '$'; - reg[len + 2] = '\0'; + reg[1] = '('; + memcpy(reg + 2, regex, len); + reg[len + 2] = ')'; + reg[len + 3] = '$'; + reg[len + 4] = '\0';
if (regcomp(&preg, reg, REG_EXTENDED | REG_NOSUB | REG_ICASE)) { LM_ERR("Error while compiling regular expression\n");