]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
ap_regex: Follow up to r1897240: Fix issues spotted by RĂ¼diger (thanks!).
authorYann Ylavic <ylavic@apache.org>
Thu, 20 Jan 2022 13:15:36 +0000 (13:15 +0000)
committerYann Ylavic <ylavic@apache.org>
Thu, 20 Jan 2022 13:15:36 +0000 (13:15 +0000)
#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

server/main.c
server/util_pcre.c

index 8a1d5273d928e8f3c27f748a7eac36ed0667f9b5..9f9965598d2b54fa93fb2cb873a5744976abb670 100644 (file)
@@ -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"
 
index 0233d161d6c24bb19ea619c63f99445f347eff23..2a3deefeade20cf9a10cb52a4b69701bf3793544 100644 (file)
@@ -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);