commit c0e15f8: [Minor] Try to fix another boundary issue

Vsevolod Stakhov vsevolod at highsecure.ru
Fri May 7 11:14:04 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-05-07 12:08:18 +0100
URL: https://github.com/rspamd/rspamd/commit/c0e15f80395c488709b9e1bac6bec664791a5448 (HEAD -> master)

[Minor] Try to fix another boundary issue

---
 lualib/lua_magic/heuristics.lua | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lualib/lua_magic/heuristics.lua b/lualib/lua_magic/heuristics.lua
index fc7743896..f539954ef 100644
--- a/lualib/lua_magic/heuristics.lua
+++ b/lualib/lua_magic/heuristics.lua
@@ -333,7 +333,7 @@ exports.text_part_heuristic = function(part, log_obj, _)
       local b = bytes[idx]
       local n8bit = 0
 
-      while b >= 127 and idx <= len do
+      while b >= 127 and idx < len do
         -- utf8 part
         if bit.band(b, 0xe0) == 0xc0 and remain > 1 and
                 bit.band(bytes[idx + 1], 0xc0) == 0x80 then


More information about the Commits mailing list