From ada2d8000bb8ff179fc0a9811fa69f8a698be22d Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 8 Dec 2021 14:05:35 +0000 Subject: [PATCH] [Minor] Another ubsan catch --- src/libserver/html/html.cxx | 8 +++++--- src/plugins/lua/multimap.lua | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/libserver/html/html.cxx b/src/libserver/html/html.cxx index c782148d2..79120d109 100644 --- a/src/libserver/html/html.cxx +++ b/src/libserver/html/html.cxx @@ -2254,10 +2254,12 @@ rspamd_html_tag_seen(void *ptr, const gchar *tagname) const gchar * rspamd_html_tag_by_id(gint id) { - const auto *td = rspamd::html::html_tags_defs.by_id(id); + if (id > Tag_UNKNOWN && id < Tag_MAX) { + const auto *td = rspamd::html::html_tags_defs.by_id(id); - if (td != nullptr) { - return td->name.c_str(); + if (td != nullptr) { + return td->name.c_str(); + } } return nullptr; diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua index 8ae903078..2edc87870 100644 --- a/src/plugins/lua/multimap.lua +++ b/src/plugins/lua/multimap.lua @@ -821,6 +821,7 @@ local function multimap_callback(task, rule) end else local hv = task:get_header_full(rule['header']) + lua_util.debugm(N, task, "hui: %s", hv) match_list(rule, hv, {'decoded'}) end end, -- 2.39.5