Skip to content

Commit

Permalink
core: fix regex error for modules parameters
Browse files Browse the repository at this point in the history
Ambiguous was possible in params for multiple modules in one config line.
  • Loading branch information
snen committed Jul 10, 2016
1 parent c3acb86 commit 198b116
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions modparam.c
Expand Up @@ -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");
Expand Down

0 comments on commit 198b116

Please sign in to comment.