Skip to content

Commit 3f4c02f

Browse files
authored
Merge pull request #3154 from marcstern/v2/pcre
Use PCRE_STUDY_EXTRA_NEEDED flag
2 parents e7a6420 + bc682d5 commit 3f4c02f

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

apache2/msc_pcre.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,7 @@ static apr_status_t msc_pcre_cleanup(msc_regex_t *regex) {
3131
}
3232
#else
3333
if (regex->pe != NULL) {
34-
#if defined(VERSION_NGINX)
3534
pcre_free(regex->pe);
36-
#else
37-
free(regex->pe);
38-
#endif
3935
regex->pe = NULL;
4036
}
4137
if (regex->re != NULL) {
@@ -160,11 +156,7 @@ void *msc_pregcomp_ex(apr_pool_t *pool, const char *pattern, int options,
160156

161157
/* Setup the pcre_extra record if pcre_study did not already do it */
162158
if (pe == NULL) {
163-
#if defined(VERSION_NGINX)
164-
pe = pcre_malloc(sizeof(pcre_extra));
165-
#else
166-
pe = malloc(sizeof(pcre_extra));
167-
#endif
159+
pe = (pcre_extra*)pcre_malloc(sizeof(pcre_extra));
168160
if (pe == NULL) {
169161
return NULL;
170162
}

apache2/re_operators.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ static int msre_op_validateHash_param_init(msre_rule *rule, char **error_msg) {
692692
const char *pattern = rule->op_param;
693693
#ifdef WITH_PCRE_STUDY
694694
#ifdef WITH_PCRE_JIT
695-
int rc, jit;
695+
int rc, jit = 0;
696696
#endif
697697
#endif
698698

@@ -775,7 +775,7 @@ static int msre_op_validateHash_execute(modsec_rec *msr, msre_rule *rule, msre_v
775775
int rc;
776776
#ifdef WITH_PCRE_STUDY
777777
#ifdef WITH_PCRE_JIT
778-
int jit;
778+
int jit = 0;
779779
#endif
780780
#endif
781781

@@ -967,7 +967,7 @@ static int msre_op_rx_param_init(msre_rule *rule, char **error_msg) {
967967
const char *pattern = rule->op_param;
968968
#ifdef WITH_PCRE_STUDY
969969
#ifdef WITH_PCRE_JIT
970-
int rc, jit;
970+
int rc, jit = 0;
971971
#endif
972972
#endif
973973

@@ -1050,7 +1050,7 @@ static int msre_op_rx_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, c
10501050
msc_parm *mparm = NULL;
10511051
#ifdef WITH_PCRE_STUDY
10521052
#ifdef WITH_PCRE_JIT
1053-
int jit;
1053+
int jit = 0;
10541054
#endif
10551055
#endif
10561056

@@ -2933,7 +2933,7 @@ static int msre_op_verifyCC_execute(modsec_rec *msr, msre_rule *rule, msre_var *
29332933
msc_parm *mparm = NULL;
29342934
#ifdef WITH_PCRE_STUDY
29352935
#ifdef WITH_PCRE_JIT
2936-
int jit;
2936+
int jit = 0;
29372937
#endif
29382938
#endif
29392939

@@ -3266,7 +3266,7 @@ static int msre_op_verifyCPF_execute(modsec_rec *msr, msre_rule *rule, msre_var
32663266
msc_parm *mparm = NULL;
32673267
#ifdef WITH_PCRE_STUDY
32683268
#ifdef WITH_PCRE_JIT
3269-
int jit;
3269+
int jit = 0;
32703270
#endif
32713271
#endif
32723272

@@ -3586,7 +3586,7 @@ static int msre_op_verifySSN_execute(modsec_rec *msr, msre_rule *rule, msre_var
35863586
msc_parm *mparm = NULL;
35873587
#ifdef WITH_PCRE_STUDY
35883588
#ifdef WITH_PCRE_JIT
3589-
int jit;
3589+
int jit = 0;
35903590
#endif
35913591
#endif
35923592

0 commit comments

Comments
 (0)