mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 19:24:29 +03:00
Use PCRE_STUDY_EXTRA_NEEDED flag
This commit is contained in:
@@ -31,11 +31,7 @@ static apr_status_t msc_pcre_cleanup(msc_regex_t *regex) {
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (regex->pe != NULL) {
|
if (regex->pe != NULL) {
|
||||||
#if defined(VERSION_NGINX)
|
|
||||||
pcre_free(regex->pe);
|
pcre_free(regex->pe);
|
||||||
#else
|
|
||||||
free(regex->pe);
|
|
||||||
#endif
|
|
||||||
regex->pe = NULL;
|
regex->pe = NULL;
|
||||||
}
|
}
|
||||||
if (regex->re != NULL) {
|
if (regex->re != NULL) {
|
||||||
@@ -152,19 +148,15 @@ void *msc_pregcomp_ex(apr_pool_t *pool, const char *pattern, int options,
|
|||||||
|
|
||||||
#ifdef WITH_PCRE_STUDY
|
#ifdef WITH_PCRE_STUDY
|
||||||
#ifdef WITH_PCRE_JIT
|
#ifdef WITH_PCRE_JIT
|
||||||
pe = pcre_study(regex->re, PCRE_STUDY_JIT_COMPILE, &errptr);
|
pe = pcre_study(regex->re, PCRE_STUDY_EXTRA_NEEDED|PCRE_STUDY_JIT_COMPILE, &errptr);
|
||||||
#else
|
#else
|
||||||
pe = pcre_study(regex->re, 0, &errptr);
|
pe = pcre_study(regex->re, PCRE_STUDY_EXTRA_NEEDED, &errptr);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Setup the pcre_extra record if pcre_study did not already do it */
|
/* Setup the pcre_extra record if pcre_study did not already do it */
|
||||||
if (pe == NULL) {
|
if (pe == NULL) {
|
||||||
#if defined(VERSION_NGINX)
|
pe = (pcre_extra*)pcre_malloc(sizeof(pcre_extra));
|
||||||
pe = pcre_malloc(sizeof(pcre_extra));
|
|
||||||
#else
|
|
||||||
pe = malloc(sizeof(pcre_extra));
|
|
||||||
#endif
|
|
||||||
if (pe == NULL) {
|
if (pe == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@@ -701,7 +701,7 @@ static int msre_op_validateHash_param_init(msre_rule *rule, char **error_msg) {
|
|||||||
const char *pattern = rule->op_param;
|
const char *pattern = rule->op_param;
|
||||||
#ifdef WITH_PCRE_STUDY
|
#ifdef WITH_PCRE_STUDY
|
||||||
#ifdef WITH_PCRE_JIT
|
#ifdef WITH_PCRE_JIT
|
||||||
int rc, jit;
|
int rc, jit = 0;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -784,7 +784,7 @@ static int msre_op_validateHash_execute(modsec_rec *msr, msre_rule *rule, msre_v
|
|||||||
int rc;
|
int rc;
|
||||||
#ifdef WITH_PCRE_STUDY
|
#ifdef WITH_PCRE_STUDY
|
||||||
#ifdef WITH_PCRE_JIT
|
#ifdef WITH_PCRE_JIT
|
||||||
int jit;
|
int jit = 0;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -976,7 +976,7 @@ static int msre_op_rx_param_init(msre_rule *rule, char **error_msg) {
|
|||||||
const char *pattern = rule->op_param;
|
const char *pattern = rule->op_param;
|
||||||
#ifdef WITH_PCRE_STUDY
|
#ifdef WITH_PCRE_STUDY
|
||||||
#ifdef WITH_PCRE_JIT
|
#ifdef WITH_PCRE_JIT
|
||||||
int rc, jit;
|
int rc, jit = 0;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1059,7 +1059,7 @@ static int msre_op_rx_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, c
|
|||||||
msc_parm *mparm = NULL;
|
msc_parm *mparm = NULL;
|
||||||
#ifdef WITH_PCRE_STUDY
|
#ifdef WITH_PCRE_STUDY
|
||||||
#ifdef WITH_PCRE_JIT
|
#ifdef WITH_PCRE_JIT
|
||||||
int jit;
|
int jit = 0;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -2942,7 +2942,7 @@ static int msre_op_verifyCC_execute(modsec_rec *msr, msre_rule *rule, msre_var *
|
|||||||
msc_parm *mparm = NULL;
|
msc_parm *mparm = NULL;
|
||||||
#ifdef WITH_PCRE_STUDY
|
#ifdef WITH_PCRE_STUDY
|
||||||
#ifdef WITH_PCRE_JIT
|
#ifdef WITH_PCRE_JIT
|
||||||
int jit;
|
int jit = 0;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -3275,7 +3275,7 @@ static int msre_op_verifyCPF_execute(modsec_rec *msr, msre_rule *rule, msre_var
|
|||||||
msc_parm *mparm = NULL;
|
msc_parm *mparm = NULL;
|
||||||
#ifdef WITH_PCRE_STUDY
|
#ifdef WITH_PCRE_STUDY
|
||||||
#ifdef WITH_PCRE_JIT
|
#ifdef WITH_PCRE_JIT
|
||||||
int jit;
|
int jit = 0;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -3595,7 +3595,7 @@ static int msre_op_verifySSN_execute(modsec_rec *msr, msre_rule *rule, msre_var
|
|||||||
msc_parm *mparm = NULL;
|
msc_parm *mparm = NULL;
|
||||||
#ifdef WITH_PCRE_STUDY
|
#ifdef WITH_PCRE_STUDY
|
||||||
#ifdef WITH_PCRE_JIT
|
#ifdef WITH_PCRE_JIT
|
||||||
int jit;
|
int jit = 0;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user