From: Vsevolod Stakhov Date: Mon, 17 May 2021 20:13:53 +0000 (+0100) Subject: [Minor] Fix non-utf inputs checking X-Git-Tag: 3.0~395 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f8e81ccc2c3da02b7d0a0451a034cccf8b5846b8;p=thirdparty%2Frspamd.git [Minor] Fix non-utf inputs checking --- diff --git a/lualib/lua_magic/heuristics.lua b/lualib/lua_magic/heuristics.lua index f539954efd..b124954f10 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