From 12652841746da7ae2f03b8b0c571a9bd5033e15c Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Wed, 19 Oct 2022 13:58:24 +0100 Subject: gentoo auto-resync : 19:10:2022 - 13:58:24 --- mail-mta/exim/files/exim-4.94-CVE-2022-3559.patch | 97 +++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 mail-mta/exim/files/exim-4.94-CVE-2022-3559.patch (limited to 'mail-mta/exim/files/exim-4.94-CVE-2022-3559.patch') diff --git a/mail-mta/exim/files/exim-4.94-CVE-2022-3559.patch b/mail-mta/exim/files/exim-4.94-CVE-2022-3559.patch new file mode 100644 index 000000000000..8793514b8fb7 --- /dev/null +++ b/mail-mta/exim/files/exim-4.94-CVE-2022-3559.patch @@ -0,0 +1,97 @@ +Patch cleaned up for Gentoo +- applied to 4.94 +- removed unnecessary whitespace changes + +From 4e9ed49f8f12eb331b29bd5b6dc3693c520fddc2 Mon Sep 17 00:00:00 2001 +From: Jeremy Harris +Date: Wed, 31 Aug 2022 15:37:40 +0100 +Subject: [PATCH 1/1] Fix $regex use-after-free. Bug 2915 + +--- exim-4.94.2/src/exim.c 2021-04-30 14:08:21.000000000 +0200 ++++ exim-4.94.2/src/exim.c 2022-10-19 09:15:58.611447982 +0200 +@@ -1886,8 +1886,6 @@ + regex_must_compile(US"^[A-Za-z0-9_/.-]*$", FALSE, TRUE); + #endif + +-for (i = 0; i < REGEX_VARS; i++) regex_vars[i] = NULL; +- + /* If the program is called as "mailq" treat it as equivalent to "exim -bp"; + this seems to be a generally accepted convention, since one finds symbolic + links called "mailq" in standard OS configurations. */ +@@ -5841,7 +5839,7 @@ + deliver_localpart_data = deliver_domain_data = + recipient_data = sender_data = NULL; + acl_var_m = NULL; +- for(int i = 0; i < REGEX_VARS; i++) regex_vars[i] = NULL; ++ regex_vars_clear(); + + store_reset(reset_point); + } +--- exim-4.94.2/src/functions.h 2021-04-30 14:08:21.000000000 +0200 ++++ exim-4.94.2/src/functions.h 2022-10-19 09:17:44.882122667 +0200 +@@ -417,6 +417,7 @@ + #endif + extern BOOL regex_match_and_setup(const pcre *, const uschar *, int, int); + extern const pcre *regex_must_compile(const uschar *, BOOL, BOOL); ++extern void regex_vars_clear(void); + extern void retry_add_item(address_item *, uschar *, int); + extern BOOL retry_check_address(const uschar *, host_item *, uschar *, BOOL, + uschar **, uschar **); +--- exim-4.94.2/src/globals.c 2022-10-19 09:14:19.344751853 +0200 ++++ exim-4.94.2/src/globals.c 2022-10-19 09:18:27.675991666 +0200 +@@ -1289,7 +1289,7 @@ + #endif + const pcre *regex_ismsgid = NULL; + const pcre *regex_smtp_code = NULL; +-uschar *regex_vars[REGEX_VARS]; ++uschar *regex_vars[REGEX_VARS] = { 0 }; + #ifdef WHITELIST_D_MACROS + const pcre *regex_whitelisted_macro = NULL; + #endif +--- exim-4.94.2/src/regex.c 2021-04-30 14:08:21.000000000 +0200 ++++ exim-4.94.2/src/regex.c 2022-10-19 09:35:03.229084750 +0200 +@@ -98,7 +106,7 @@ + int ret = FAIL; + + /* reset expansion variable */ +-regex_match_string = NULL; ++regex_vars_clear(); + + if (!mime_stream) /* We are in the DATA ACL */ + { +@@ -166,8 +174,7 @@ + int mime_subject_len = 0; + int ret; + +-/* reset expansion variable */ +-regex_match_string = NULL; ++regex_vars_clear(); + + /* precompile our regexes */ + if (!(re_list_head = compile(*listptr))) +@@ -213,3 +205,12 @@ + } + + #endif /* WITH_CONTENT_SCAN */ ++ ++/* reset expansion variables */ ++void ++regex_vars_clear(void) ++{ ++regex_match_string = NULL; ++for (int i = 0; i < REGEX_VARS; i++) regex_vars[i] = NULL; ++} ++ +--- exim-4.94.2/src/smtp_in.c 2021-04-30 14:08:21.000000000 +0200 ++++ exim-4.94.2/src/smtp_in.c 2022-10-19 09:15:58.613447975 +0200 +@@ -2161,8 +2161,10 @@ + #ifdef SUPPORT_I18N + message_smtputf8 = FALSE; + #endif ++regex_vars_clear(); + body_linecount = body_zerocount = 0; + ++lookup_value = NULL; /* Can be set by ACL */ + sender_rate = sender_rate_limit = sender_rate_period = NULL; + ratelimiters_mail = NULL; /* Updated by ratelimit ACL condition */ + /* Note that ratelimiters_conn persists across resets. */ -- cgit v1.2.3