mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-19 07:36:12 +03:00
Merge pull request #8 from hideaki/strmatch_coredump
handle invalid escape sequence passed to strmatch operator
This commit is contained in:
commit
b31f83b292
@ -2394,6 +2394,7 @@ static int msre_op_endsWith_execute(modsec_rec *msr, msre_rule *rule, msre_var *
|
|||||||
|
|
||||||
static int msre_op_strmatch_param_init(msre_rule *rule, char **error_msg) {
|
static int msre_op_strmatch_param_init(msre_rule *rule, char **error_msg) {
|
||||||
const apr_strmatch_pattern *compiled_pattern;
|
const apr_strmatch_pattern *compiled_pattern;
|
||||||
|
char *processed = NULL;
|
||||||
const char *pattern = rule->op_param;
|
const char *pattern = rule->op_param;
|
||||||
unsigned short int op_len;
|
unsigned short int op_len;
|
||||||
|
|
||||||
@ -2402,8 +2403,14 @@ static int msre_op_strmatch_param_init(msre_rule *rule, char **error_msg) {
|
|||||||
|
|
||||||
op_len = strlen(pattern);
|
op_len = strlen(pattern);
|
||||||
|
|
||||||
|
/* Process pattern */
|
||||||
|
processed = parse_pm_content(pattern, op_len, rule, error_msg);
|
||||||
|
if (processed == NULL) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Compile pattern */
|
/* Compile pattern */
|
||||||
compiled_pattern = apr_strmatch_precompile(rule->ruleset->mp, parse_pm_content(pattern, op_len, rule, error_msg), 1);
|
compiled_pattern = apr_strmatch_precompile(rule->ruleset->mp, processed, 1);
|
||||||
if (compiled_pattern == NULL) {
|
if (compiled_pattern == NULL) {
|
||||||
*error_msg = apr_psprintf(rule->ruleset->mp, "Error compiling pattern: %s", pattern);
|
*error_msg = apr_psprintf(rule->ruleset->mp, "Error compiling pattern: %s", pattern);
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user