Skip to content

Commit 5c79cb0

Browse files
authored
Merge pull request #3066 from owasp-modsecurity/revert-2946-v2/mst/issue610
Revert "Fix for #610"
2 parents f2de578 + b034f5a commit 5c79cb0

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

apache2/msc_pcre.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ static apr_status_t msc_pcre_cleanup(msc_regex_t *regex) {
3131
}
3232
#else
3333
if (regex->pe != NULL) {
34+
#if defined(VERSION_NGINX)
3435
pcre_free(regex->pe);
36+
#else
37+
free(regex->pe);
38+
#endif
3539
regex->pe = NULL;
3640
}
3741
if (regex->re != NULL) {
@@ -148,15 +152,19 @@ void *msc_pregcomp_ex(apr_pool_t *pool, const char *pattern, int options,
148152

149153
#ifdef WITH_PCRE_STUDY
150154
#ifdef WITH_PCRE_JIT
151-
pe = pcre_study(regex->re, PCRE_STUDY_EXTRA_NEEDED|PCRE_STUDY_JIT_COMPILE, &errptr);
155+
pe = pcre_study(regex->re, PCRE_STUDY_JIT_COMPILE, &errptr);
152156
#else
153-
pe = pcre_study(regex->re, PCRE_STUDY_EXTRA_NEEDED, &errptr);
157+
pe = pcre_study(regex->re, 0, &errptr);
154158
#endif
155159
#endif
156160

157161
/* Setup the pcre_extra record if pcre_study did not already do it */
158162
if (pe == NULL) {
159-
pe = (pcre_extra*)pcre_malloc(sizeof(pcre_extra));
163+
#if defined(VERSION_NGINX)
164+
pe = pcre_malloc(sizeof(pcre_extra));
165+
#else
166+
pe = malloc(sizeof(pcre_extra));
167+
#endif
160168
if (pe == NULL) {
161169
return NULL;
162170
}

0 commit comments

Comments
 (0)