Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 24 additions & 7 deletions apache2/re_operators.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,23 @@

#include "libinjection/libinjection.h"

#ifdef WITH_PCRE2
/**
* @brief Set the JIT compile return code and JIT compile status.
* \param regex regex structure
* \param rc return code of the JIT compile
* \param jit JIT compile status
* \return void
*/
static void msc_op_set_jitrc(msc_regex_t *regex, int *rc, int *jit) {
*rc = regex->jit_compile_rc;
if (*rc == 0) {
msc_fullinfo(regex, PCRE2_INFO_JITSIZE, jit);
*jit = (*jit > 0) ? 1 : 0;
}
return;
}
#endif

/**
*
Expand Down Expand Up @@ -724,7 +741,7 @@ static int msre_op_validateHash_param_init(msre_rule *rule, char **error_msg) {
#ifdef WITH_PCRE_STUDY
#ifdef WITH_PCRE_JIT
#ifdef WITH_PCRE2
rc = regex->jit_compile_rc;
msc_op_set_jitrc(regex, &rc, &jit);
#else
rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit);
#endif
Expand Down Expand Up @@ -830,7 +847,7 @@ static int msre_op_validateHash_execute(modsec_rec *msr, msre_rule *rule, msre_v
#ifdef WITH_PCRE_JIT
if (msr->txcfg->debuglog_level >= 4) {
#ifdef WITH_PCRE2
rc = regex->jit_compile_rc;
msc_op_set_jitrc(regex, &rc, &jit);
#else
rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit);
#endif
Expand Down Expand Up @@ -1001,7 +1018,7 @@ static int msre_op_rx_param_init(msre_rule *rule, char **error_msg) {
#ifdef WITH_PCRE_STUDY
#ifdef WITH_PCRE_JIT
#ifdef WITH_PCRE2
rc = regex->jit_compile_rc;
msc_op_set_jitrc(regex, &rc, &jit);
#else
rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit);
#endif
Expand Down Expand Up @@ -1099,7 +1116,7 @@ static int msre_op_rx_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, c
#ifdef WITH_PCRE_JIT
if (msr->txcfg->debuglog_level >= 4) {
#ifdef WITH_PCRE2
rc = regex->jit_compile_rc;
msc_op_set_jitrc(regex, &rc, &jit);
#else
rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit);
#endif
Expand Down Expand Up @@ -2990,7 +3007,7 @@ static int msre_op_verifyCC_execute(modsec_rec *msr, msre_rule *rule, msre_var *
#ifdef WITH_PCRE_JIT
if (msr->txcfg->debuglog_level >= 4) {
#ifdef WITH_PCRE2
rc = regex->jit_compile_rc;
msc_op_set_jitrc(regex, &rc, &jit);
#else
rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit);
#endif
Expand Down Expand Up @@ -3329,7 +3346,7 @@ static int msre_op_verifyCPF_execute(modsec_rec *msr, msre_rule *rule, msre_var
#ifdef WITH_PCRE_JIT
if (msr->txcfg->debuglog_level >= 4) {
#ifdef WITH_PCRE2
rc = regex->jit_compile_rc;
msc_op_set_jitrc(regex, &rc, &jit);
#else
rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit);
#endif
Expand Down Expand Up @@ -3654,7 +3671,7 @@ static int msre_op_verifySSN_execute(modsec_rec *msr, msre_rule *rule, msre_var
#ifdef WITH_PCRE_JIT
if (msr->txcfg->debuglog_level >= 4) {
#ifdef WITH_PCRE2
rc = regex->jit_compile_rc;
msc_op_set_jitrc(regex, &rc, &jit);
#else
rc = msc_fullinfo(regex, PCRE_INFO_JIT, &jit);
#endif
Expand Down
Loading