diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-07-02 16:51:01 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-07-02 16:51:01 +0100 |
commit | 8ea559e6a757039b40d01fbee45b3866839df230 (patch) | |
tree | ac859e4f85fe8ca55cf0495d80bb9020d88a15c3 /rules | |
parent | 56129a44f9f72091ab2b500746f3d0a47ee88b5c (diff) | |
download | rspamd-8ea559e6a757039b40d01fbee45b3866839df230.tar.gz rspamd-8ea559e6a757039b40d01fbee45b3866839df230.zip |
[Minor] Add more sanity checks
Diffstat (limited to 'rules')
-rw-r--r-- | rules/bitcoin.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/rules/bitcoin.lua b/rules/bitcoin.lua index e674795a3..a9e78a1c4 100644 --- a/rules/bitcoin.lua +++ b/rules/bitcoin.lua @@ -147,7 +147,7 @@ local function is_segwit_bech32_address(word) local rspamd_util = require 'rspamd_util' local decoded = rspamd_util.decode_base32(word:lower(), 'bleach') - if decoded then + if decoded and #decoded > 0 then local bytes = decoded:bytes() -- The version byte’s most signficant bit is reserved and must be 0. @@ -156,7 +156,7 @@ local function is_segwit_bech32_address(word) local addr_type = bit.rshift(bit.band(bytes[1], 120), 3) local _ = bit.band(bytes[1], 7) -- hash size - if version == 0 and (addr_type == 0 or addr_type == 8)then + if version == 0 and (addr_type == 0 or addr_type == 8) then -- TODO: Add checksum validation some day return true |