diff options
author | Anton Yuzhaninov <citrin+git@citrin.ru> | 2021-09-17 09:46:32 +0100 |
---|---|---|
committer | Anton Yuzhaninov <citrin+git@citrin.ru> | 2021-09-17 09:46:32 +0100 |
commit | 98b205709fbbb3b1b8aa337e234747f9eac8caf7 (patch) | |
tree | 4065ff2994d4ecebba4fadb0988c45158849c3b5 | |
parent | 21a1720ac3b4953a250ad092dc7ccfd681600a35 (diff) | |
download | rspamd-98b205709fbbb3b1b8aa337e234747f9eac8caf7.tar.gz rspamd-98b205709fbbb3b1b8aa337e234747f9eac8caf7.zip |
[Minor] Skip bitcoin address check for very long words
Exclude very long words (which can be extracted e. g. from some text
attachments) from bitcoin address check to avoid excessive resource
usage.
-rw-r--r-- | rules/bitcoin.lua | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/rules/bitcoin.lua b/rules/bitcoin.lua index 3cf97fcbe..731bf4672 100644 --- a/rules/bitcoin.lua +++ b/rules/bitcoin.lua @@ -184,7 +184,8 @@ config.regexp['BITCOIN_ADDR'] = { re = string.format('(%s) + (%s) > 0', normal_wallet_re, btc_bleach_re), re_conditions = { [normal_wallet_re] = function(task, txt, s, e) - if e - s <= 2 then + local len = e - s + if len <= 2 or len > 1024 then return false end @@ -205,7 +206,8 @@ config.regexp['BITCOIN_ADDR'] = { end end, [btc_bleach_re] = function(task, txt, s, e) - if e - s <= 2 then + local len = e - s + if len <= 2 or len > 1024 then return false end |