mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 19:24:29 +03:00
Nginx: fixed crash in pcre
This commit is contained in:
@@ -21,7 +21,11 @@
|
|||||||
static apr_status_t msc_pcre_cleanup(msc_regex_t *regex) {
|
static apr_status_t msc_pcre_cleanup(msc_regex_t *regex) {
|
||||||
if (regex != NULL) {
|
if (regex != NULL) {
|
||||||
if (regex->pe != NULL) {
|
if (regex->pe != NULL) {
|
||||||
|
#if defined(VERSION_NGINX)
|
||||||
|
pcre_free(regex->pe);
|
||||||
|
#else
|
||||||
free(regex->pe);
|
free(regex->pe);
|
||||||
|
#endif
|
||||||
regex->pe = NULL;
|
regex->pe = NULL;
|
||||||
}
|
}
|
||||||
if (regex->re != NULL) {
|
if (regex->re != NULL) {
|
||||||
@@ -71,7 +75,11 @@ void *msc_pregcomp_ex(apr_pool_t *pool, const char *pattern, int options,
|
|||||||
|
|
||||||
/* 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_malloc(sizeof(pcre_extra));
|
||||||
|
#else
|
||||||
pe = malloc(sizeof(pcre_extra));
|
pe = malloc(sizeof(pcre_extra));
|
||||||
|
#endif
|
||||||
if (pe == NULL) {
|
if (pe == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user