Skip to content

Commit 2b2535c

Browse files
committed
Split error handling into two parts; add regular log in case of failed compilation
1 parent be37489 commit 2b2535c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

apache2/re.c

+10
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,18 @@ static int fetch_target_exception(msre_rule *rule, modsec_rec *msr, msre_var *va
129129
#endif
130130
if (regex == NULL) {
131131
if (msr->txcfg->debuglog_level >= 9) {
132+
#ifdef WITH_PCRE2
133+
// in case of PCRE2 the errptr won't fill
134+
msr_log(msr, 9, "fetch_target_exception: Regexp /%s/ failed to compile at pos %d.",
135+
value + 1, erroffset);
136+
ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, " ModSecurity: exclusion regexp /%s/ failed to compile at pos %d.",
137+
value + 1, erroffset);
138+
#else
132139
msr_log(msr, 9, "fetch_target_exception: Regexp /%s/ failed to compile at pos %d: %s.",
133140
value + 1, erroffset, errptr);
141+
ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, " ModSecurity: exclusion regexp /%s/ failed to compile at pos %d: %s.",
142+
value + 1, erroffset, errptr);
143+
#endif
134144
}
135145
} else {
136146
#ifdef WITH_PCRE2

0 commit comments

Comments
 (0)