Module: kamailio Branch: master Commit: fb3699456115ca0196ee38646ddf431f7a73cf54 URL: https://github.com/kamailio/kamailio/commit/fb3699456115ca0196ee38646ddf431f...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: GitHub noreply@github.com Date: 2016-07-11T09:08:41+02:00
Merge pull request #703 from snen/module_parameter_regexp_fix
core: fix regex error for modules parameters
---
Modified: modparam.c
---
Diff: https://github.com/kamailio/kamailio/commit/fb3699456115ca0196ee38646ddf431f... Patch: https://github.com/kamailio/kamailio/commit/fb3699456115ca0196ee38646ddf431f...
---
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");