]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Slight regexp and capture improvements
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 30 Jul 2020 12:13:26 +0000 (13:13 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 30 Jul 2020 12:13:26 +0000 (13:13 +0100)
rules/bitcoin.lua

index 406f4afa92e0d608b89602b352ff4fb472deb150..c14a84dc2dbf83b92f2c4d85ad501ea5ef5a03ec 100644 (file)
@@ -176,7 +176,7 @@ local function is_segwit_bech32_address(task, word)
 end
 
 local normal_wallet_re = [[/\b[13LM][1-9A-Za-z]{25,34}\b/AL{sa_body}]]
-local btc_bleach_re = [[/\b(?:\w+:)?[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{14,}\b/AL{sa_body}]]
+local btc_bleach_re = [[/\b(?:[a-zA-Z]\w+:)?[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{14,}\b/AL{sa_body}]]
 
 config.regexp['BITCOIN_ADDR'] = {
   description = 'Message has a valid bitcoin wallet address',
@@ -187,7 +187,7 @@ config.regexp['BITCOIN_ADDR'] = {
         return false
       end
 
-      local word = lua_util.str_trim(txt:sub(s, e))
+      local word = lua_util.str_trim(txt:sub(s + 1, e))
       local valid = is_traditional_btc_address(word)
 
       if valid then
@@ -208,7 +208,7 @@ config.regexp['BITCOIN_ADDR'] = {
         return false
       end
 
-      local word = tostring(lua_util.str_trim(txt:sub(s, e)))
+      local word = tostring(lua_util.str_trim(txt:sub(s + 1, e)))
       local valid = is_segwit_bech32_address(task, word)
 
       if valid then