Module: kamailio Branch: master Commit: 9cae069832c8f37ebf9e686b3fbcab5d63652755 URL: https://github.com/kamailio/kamailio/commit/9cae069832c8f37ebf9e686b3fbcab5d63652755
Author: Daniel-Constantin Mierla <mico...@gmail.com> Committer: Daniel-Constantin Mierla <mico...@gmail.com> Date: 2020-05-11T17:46:29+02:00 regex: leave enough space in buffers for parenthesis and -ending --- Modified: src/modules/regex/regex_mod.c --- Diff: https://github.com/kamailio/kamailio/commit/9cae069832c8f37ebf9e686b3fbcab5d63652755.diff Patch: https://github.com/kamailio/kamailio/commit/9cae069832c8f37ebf9e686b3fbcab5d63652755.patch --- diff --git a/src/modules/regex/regex_mod.c b/src/modules/regex/regex_mod.c index 880e1924fd..475c3542eb 100644 --- a/src/modules/regex/regex_mod.c +++ b/src/modules/regex/regex_mod.c @@ -275,7 +275,7 @@ static int load_pcres(int action) /* Read the file and extract the patterns */ memset(line, 0, FILE_MAX_LINE); i = -1; - while (fgets(line, FILE_MAX_LINE, f) != NULL) { + while (fgets(line, FILE_MAX_LINE-4, f) != NULL) { /* Ignore comments and lines starting by space, tab, CR, LF */ if(isspace(line[0]) || line[0]=='#') { @@ -306,7 +306,7 @@ static int load_pcres(int action) } /* Check if the patter size is too big (aprox) */ - if (strlen(patterns[i]) + strlen(line) >= group_max_size - 2) { + if (strlen(patterns[i]) + strlen(line) >= group_max_size - 4) { LM_ERR("pattern max file exceeded\n"); fclose(f); goto err; _______________________________________________ Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev