From 1ee4b159437edc1d991860008371f587c3283cda Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 5 Nov 2019 10:50:34 +0000 Subject: [Fix] Rbl: Allow utf8 lookups for IDN domains Issue: #3137 --- src/plugins/lua/rbl.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') 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 -- cgit v1.2.3