commit 1ee4b15: [Fix] Rbl: Allow utf8 lookups for IDN domains

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Nov 5 10:56:06 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-11-05 10:50:34 +0000
URL: https://github.com/rspamd/rspamd/commit/1ee4b159437edc1d991860008371f587c3283cda (HEAD -> master)

[Fix] Rbl: Allow utf8 lookups for IDN domains
Issue: #3137

---
 src/plugins/lua/rbl.lua | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/plugins/lua/rbl.lua b/src/plugins/lua/rbl.lua
index 623de0a37..521e63708 100644
--- a/src/plugins/lua/rbl.lua
+++ b/src/plugins/lua/rbl.lua
@@ -70,9 +70,12 @@ local function validate_dns(lstr)
     -- two dots in a row
     return false
   end
+  if not rspamd_util.is_valid_utf8(lstr) then
+    -- invalid utf8 detected
+    return false
+  end
   for v in lstr:gmatch('[^%.]+') do
-    if not v:match('^[%w-]+$') or v:len() > 63
-        or v:match('^-') or v:match('-$') then
+    if v:len() > 63 or v:match('^-') or v:match('-$') then
       -- too long label or weird labels
       return false
     end


More information about the Commits mailing list