From: Yann Ylavic Date: Thu, 20 Jan 2022 13:15:36 +0000 (+0000) Subject: ap_regex: Follow up to r1897240: Fix issues spotted by RĂ¼diger (thanks!). X-Git-Tag: 2.5.0-alpha2-ci-test-only~574 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f01e29d89d5ef65949e2f16b40e57488e83f8819;p=thirdparty%2Fapache%2Fhttpd.git ap_regex: Follow up to r1897240: Fix issues spotted by RĂ¼diger (thanks!). #include "apr_thread_proc.h" is enough/needed by util_pcre.c and main.c. Fix compilation (vector => ovector) for !HAVE_PCRE2 && APR_HAS_THREAD_LOCAL. Check pcre2_match_data_create() return value for HAVE_PCRE2 && !APR_HAS_THREAD_LOCAL. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1897250 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/main.c b/server/main.c index 8a1d5273d92..9f9965598d2 100644 --- a/server/main.c +++ b/server/main.c @@ -21,6 +21,7 @@ #include "apr_lib.h" #include "apr_md5.h" #include "apr_time.h" +#include "apr_thread_proc.h" #include "apr_version.h" #include "apu_version.h" diff --git a/server/util_pcre.c b/server/util_pcre.c index 0233d161d6c..2a3deefeade 100644 --- a/server/util_pcre.c +++ b/server/util_pcre.c @@ -53,10 +53,9 @@ POSSIBILITY OF SUCH DAMAGE. */ #include "httpd.h" -#include "apr_version.h" -#include "apr_portable.h" #include "apr_strings.h" #include "apr_tables.h" +#include "apr_thread_proc.h" #ifdef HAVE_PCRE2 #define PCRE2_CODE_UNIT_WIDTH 8 @@ -331,7 +330,7 @@ static match_data_pt get_match_data(apr_size_t size, #ifdef HAVE_PCRE2 *ovector = pcre2_get_ovector_pointer(tls->data); #else - *vector = tls->data; + *ovector = tls->data; #endif return tls->data; } @@ -353,7 +352,9 @@ static match_data_pt get_match_data(apr_size_t size, #ifdef HAVE_PCRE2 data = pcre2_match_data_create(size, NULL); - *ovector = pcre2_get_ovector_pointer(data); + if (data) { + *ovector = pcre2_get_ovector_pointer(data); + } #else if (size > POSIX_MALLOC_THRESHOLD) { data = malloc(size * sizeof(int) * 3);