diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-05-17 21:13:53 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-05-17 21:13:53 +0100 |
commit | f8e81ccc2c3da02b7d0a0451a034cccf8b5846b8 (patch) | |
tree | 5de8075a71d13b6906b40fa24e796ddbe502f16d /lualib/lua_magic | |
parent | d3c650685f7b8f042d97bb56735d5bf92fe1e0f6 (diff) | |
download | rspamd-f8e81ccc2c3da02b7d0a0451a034cccf8b5846b8.tar.gz rspamd-f8e81ccc2c3da02b7d0a0451a034cccf8b5846b8.zip |
[Minor] Fix non-utf inputs checking
Diffstat (limited to 'lualib/lua_magic')
-rw-r--r-- | lualib/lua_magic/heuristics.lua | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lualib/lua_magic/heuristics.lua b/lualib/lua_magic/heuristics.lua index f539954ef..b124954f1 100644 --- a/lualib/lua_magic/heuristics.lua +++ b/lualib/lua_magic/heuristics.lua @@ -347,11 +347,15 @@ exports.text_part_heuristic = function(part, log_obj, _) bit.band(bytes[idx + 2], 0xc0) == 0x80 and bit.band(bytes[idx + 3], 0xc0) == 0x80 then return true,3 + else + -- Non utf + return false,0 end n8bit = n8bit + 1 idx = idx + 1 b = bytes[idx] + remain = remain - 1 end if n8bit >= 3 then |