From: Aki Tuomi Date: Mon, 1 Sep 2025 12:21:12 +0000 (+0300) Subject: lib-regex: Fail if PCRE2_SUBSTITUTE_LITERAL is not supported by pcre2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=320eccab4446fb0083c623c22c9fd86ac7e3da21;p=thirdparty%2Fdovecot%2Fcore.git lib-regex: Fail if PCRE2_SUBSTITUTE_LITERAL is not supported by pcre2 --- diff --git a/src/lib-regex/regex.c b/src/lib-regex/regex.c index 66c5f6238e..e402e6a49d 100644 --- a/src/lib-regex/regex.c +++ b/src/lib-regex/regex.c @@ -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;