]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Another ubsan catch
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 8 Dec 2021 14:05:35 +0000 (14:05 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 8 Dec 2021 14:05:35 +0000 (14:05 +0000)
src/libserver/html/html.cxx
src/plugins/lua/multimap.lua

index c782148d2e3197c818de39a09e424d5f95121ba6..79120d1098569321bab678fba05151f033b7dc3c 100644 (file)
@@ -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;
index 8ae9030783a20cbeb587894cd57767c9767e9712..2edc87870cd880112966aaed3d7c7147ee716ac5 100644 (file)
@@ -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,