X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/e63825824cc406c160ccbf2b154c5d81b168604a..481eeb93961ef9998901c522b498253d75124fb4:/src/src/malware.c diff --git a/src/src/malware.c b/src/src/malware.c index 423a5b692..760278079 100644 --- a/src/src/malware.c +++ b/src/src/malware.c @@ -3,9 +3,10 @@ *************************************************/ /* - * Copyright (c) The Exim Maintainers 2015 - 2022 + * Copyright (c) The Exim Maintainers 2015 - 2023 * Copyright (c) Tom Kistner 2003 - 2015 * License: GPL + * SPDX-License-Identifier: GPL-2.0-or-later */ /* Code for calling virus (malware) scanners. Called from acl.c. */ @@ -310,16 +311,16 @@ m_pcre_exec(const pcre2_code * cre, uschar * text) { 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 */ - if (!substr) substr = US""; + 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 * @@ -2237,7 +2238,7 @@ Returns: Exim message processing code (OK, FAIL, DEFER, ...) where true means malware was found (condition applies) */ int -malware_in_file(uschar *eml_filename) +malware_in_file(const uschar * eml_filename) { uschar message_id_buf[64]; int ret;