]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-regex: Fail if PCRE2_SUBSTITUTE_LITERAL is not supported by pcre2
authorAki Tuomi <aki.tuomi@open-xchange.com>
Mon, 1 Sep 2025 12:21:12 +0000 (15:21 +0300)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Tue, 2 Sep 2025 07:28:21 +0000 (07:28 +0000)
src/lib-regex/regex.c

index 66c5f6238e4cb8bc10f12fa729cf6d3a19155a7c..e402e6a49da1721a69723c9a161470b42c5eff1d 100644 (file)
@@ -369,8 +369,14 @@ int dregex_code_replace_full(struct dregex_code *code,
                options |= PCRE2_ANCHORED;
        if (HAS_ALL_BITS(flags, DREGEX_REPLACE_ALL))
                options |= PCRE2_SUBSTITUTE_GLOBAL;
-       if (HAS_ALL_BITS(flags, DREGEX_REPLACE_LITERAL))
+       if (HAS_ALL_BITS(flags, DREGEX_REPLACE_LITERAL)) {
+#ifdef PCRE2_SUBSTITUTE_LITERAL
                options |= PCRE2_SUBSTITUTE_LITERAL;
+#else
+               *error_r = "DREGEX_REPLACE_LITERAL not supported on this platform";
+               return -1;
+#endif
+       }
 
        PCRE2_UCHAR *result32 = U"";
        PCRE2_SIZE result_len = 0;