From: Vsevolod Stakhov Date: Wed, 19 Nov 2025 11:50:28 +0000 (+0000) Subject: [Fix] Fix maybe_adjust_type callback return and add nil check X-Git-Tag: 3.14.1~11^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b341676c59b8c1e8a010d8b0ff33d6779760bd2;p=thirdparty%2Frspamd.git [Fix] Fix maybe_adjust_type callback return and add nil check Fixed bug where maybe_adjust_type returned only mtype instead of data,mtype when mtype=='callback'. Added defensive check to prevent passing nil/empty URL to rspamd_config:add_map which would cause assertion failure. --- diff --git a/lualib/lua_maps.lua b/lualib/lua_maps.lua index 9cdee089cc..b112bbda0f 100644 --- a/lualib/lua_maps.lua +++ b/lualib/lua_maps.lua @@ -73,7 +73,7 @@ local function maybe_adjust_type(data, mtype) } if mtype == 'callback' then - return mtype + return data, mtype end for _, t in ipairs(known_types) do @@ -303,6 +303,10 @@ local function rspamd_map_add_from_ucl(opt, mtype, description, callback) if type(opt) == 'string' then opt, mtype = maybe_adjust_type(opt, mtype) + if not opt or opt == '' then + rspamd_logger.errx(rspamd_config, 'invalid map url (nil or empty): %s', description) + return nil + end local cache_key = map_hash_key(opt, mtype) if not callback and maps_cache[cache_key] then rspamd_logger.infox(rspamd_config, 'reuse url for %s(%s)',