X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/c9433c53ad292c2f7ec05aa9d083767f95d07858..c3d7f28680dda05ca6d8415cffbff8a233c0ae74:/src/src/regex.c diff --git a/src/src/regex.c b/src/src/regex.c index a3d6659a6..9b7b07405 100644 --- a/src/src/regex.c +++ b/src/src/regex.c @@ -2,9 +2,10 @@ * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) Tom Kistner 2003-2015 +/* + * Copyright (c) The Exim Maintainers 2016 - 2022 + * Copyright (c) Tom Kistner 2003-2015 * License: GPL - * Copyright (c) The Exim Maintainers 2016 - 2018 */ /* Code for matching regular expressions against headers and body. @@ -45,7 +46,7 @@ while ((regex_string = string_nextinlist(&list, &sep, NULL, 0))) /* compile our regular expression */ if (!(re = pcre2_compile( (PCRE2_SPTR) regex_string, PCRE2_ZERO_TERMINATED, - 0, &err, &pcre_erroffset, pcre_cmp_ctx))) + 0, &err, &pcre_erroffset, pcre_gen_cmp_ctx))) { uschar errbuf[128]; pcre2_get_error_message(err, errbuf, sizeof(errbuf)); @@ -55,7 +56,7 @@ while ((regex_string = string_nextinlist(&list, &sep, NULL, 0))) continue; } - ri = store_get(sizeof(pcre_list), FALSE); + ri = store_get(sizeof(pcre_list), GET_UNTAINTED); ri->re = re; ri->pcre_text = regex_string; ri->next = re_list_head; @@ -74,7 +75,7 @@ for (pcre_list * ri = re_list_head; ri; ri = ri->next) int n; /* try matcher on the line */ - if ((n = pcre2_match(ri->re, (PCRE2_SPTR)linebuffer, len, 0, 0, md, pcre_mtc_ctx)) > 0) + if ((n = pcre2_match(ri->re, (PCRE2_SPTR)linebuffer, len, 0, 0, md, pcre_gen_mtc_ctx)) > 0) { Ustrncpy(regex_match_string_buffer, ri->pcre_text, sizeof(regex_match_string_buffer)-1); @@ -84,14 +85,14 @@ for (pcre_list * ri = re_list_head; ri; ri = ri->next) { PCRE2_UCHAR * cstr; PCRE2_SIZE cslen; - pcre2_substring_get_bynumber(md, nn, &cstr, &cslen); + pcre2_substring_get_bynumber(md, nn, &cstr, &cslen); /* uses same ctx as md */ regex_vars[nn-1] = CUS cstr; } return OK; } } -pcre2_match_data_free(md); +/* pcre2_match_data_free(md); gen ctx needs no free */ return FAIL; } @@ -133,7 +134,7 @@ if (!(re_list_head = compile(*listptr))) return FAIL; /* no regexes -> nothing to do */ /* match each line against all regexes */ -linebuffer = store_get(32767, TRUE); /* tainted */ +linebuffer = store_get(32767, GET_TAINTED); while (fgets(CS linebuffer, 32767, mbox_file)) { if ( mime_stream && mime_current_boundary /* check boundary */ @@ -204,7 +205,7 @@ if (!(f = fopen(CS mime_decoded_filename, "rb"))) } /* get 32k memory, tainted */ -mime_subject = store_get(32767, TRUE); +mime_subject = store_get(32767, GET_TAINTED); mime_subject_len = fread(mime_subject, 1, 32766, f);