From bd59e849cb48c40e68ddf8ad60a3479d92fd5264 Mon Sep 17 00:00:00 2001 From: Anton Yuzhaninov Date: Sun, 10 Nov 2019 13:38:13 +0000 Subject: [PATCH] [Minor] Optimize mailman_msgid regexp The old regexp is susceptible to exponential backtracking. pcretest benchmark: ``` PCRE version 8.43 2019-02-23 /^$/ Execute time 0.0006 milliseconds 0: Execute time 9.8803 milliseconds No match /^$/ Execute time 0.0003 milliseconds 0: Execute time 0.0002 milliseconds No match ``` --- rules/regexp/headers.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rules/regexp/headers.lua b/rules/regexp/headers.lua index 25f4b725a..b70284a2a 100644 --- a/rules/regexp/headers.lua +++ b/rules/regexp/headers.lua @@ -315,7 +315,8 @@ local hotmail_baydav_msgid = 'Message-Id=/^?$/H' -- Mailman message id -local mailman_msgid = 'Message-ID=/^$/H' +-- https://bazaar.launchpad.net/~mailman-coders/mailman/2.1/view/head:/Mailman/Utils.py#L811 +local mailman_msgid = [[Message-ID=/^$/H]] -- Message id seems to be forged local unusable_msgid = string.format('(%s | %s | %s | %s | %s | %s)', lyris_ezml_remailer, wacky_sendmail_version, iplanet_messaging_server, hotmail_baydav_msgid, sympatico_msgid, mailman_msgid) -- 2.39.5