Skip to content

Commit b31f83b

Browse files
committed
Merge pull request #8 from hideaki/strmatch_coredump
handle invalid escape sequence passed to strmatch operator
2 parents 2b1c1ad + 9e6dddf commit b31f83b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

apache2/re_operators.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2394,6 +2394,7 @@ static int msre_op_endsWith_execute(modsec_rec *msr, msre_rule *rule, msre_var *
23942394

23952395
static int msre_op_strmatch_param_init(msre_rule *rule, char **error_msg) {
23962396
const apr_strmatch_pattern *compiled_pattern;
2397+
char *processed = NULL;
23972398
const char *pattern = rule->op_param;
23982399
unsigned short int op_len;
23992400

@@ -2402,8 +2403,14 @@ static int msre_op_strmatch_param_init(msre_rule *rule, char **error_msg) {
24022403

24032404
op_len = strlen(pattern);
24042405

2406+
/* Process pattern */
2407+
processed = parse_pm_content(pattern, op_len, rule, error_msg);
2408+
if (processed == NULL) {
2409+
return 0;
2410+
}
2411+
24052412
/* Compile pattern */
2406-
compiled_pattern = apr_strmatch_precompile(rule->ruleset->mp, parse_pm_content(pattern, op_len, rule, error_msg), 1);
2413+
compiled_pattern = apr_strmatch_precompile(rule->ruleset->mp, processed, 1);
24072414
if (compiled_pattern == NULL) {
24082415
*error_msg = apr_psprintf(rule->ruleset->mp, "Error compiling pattern: %s", pattern);
24092416
return 0;

0 commit comments

Comments
 (0)