* Copyright (c) The Exim Maintainers 2015 - 2022
* Copyright (c) Tom Kistner <tom@duncanthrax.net> 2003 - 2015
* License: GPL
+ * SPDX-License-Identifier: GPL-2.0-or-later
*/
/* Code for calling virus (malware) scanners. Called from acl.c. */
{
pcre2_match_data * md = pcre2_match_data_create(2, pcre_gen_ctx);
int i = pcre2_match(cre, text, PCRE2_ZERO_TERMINATED, 0, 0, md, pcre_gen_mtc_ctx);
-PCRE2_UCHAR * substr = NULL;
-PCRE2_SIZE slen;
+uschar * substr = NULL;
if (i >= 2) /* Got it */
- pcre2_substring_get_bynumber(md, 1, &substr, &slen); /* uses same ctx as md */
+ {
+ PCRE2_SIZE * ovec = pcre2_get_ovector_pointer(md);
+ int len = ovec[3] - ovec[2];
+ substr = string_copyn(text + ovec[2], len);
+ }
/* pcre2_match_data_free(md); gen ctx needs no free */
-return US substr;
+return substr;
}
static const pcre2_code *