From: Vsevolod Stakhov Date: Sun, 5 Oct 2025 16:09:46 +0000 (+0100) Subject: [Fix] Fix segfault due to incorrect HTML features access X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a13f79a6552b98dc3ca2799b4643a8f779bb44c5;p=thirdparty%2Frspamd.git [Fix] Fix segfault due to incorrect HTML features access The fuzzy_cmd_from_html_part() function incorrectly accessed HTML features via part->html_features (which doesn't exist), causing segmentation faults. Fixed to use the correct path part->html->features for accessing tags_count, links.total_links, and max_dom_depth properties. --- diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index 5139783e56..5c14f51711 100644 --- a/src/plugins/fuzzy_check.c +++ b/src/plugins/fuzzy_check.c @@ -2267,9 +2267,9 @@ fuzzy_cmd_from_html_part(struct rspamd_task *task, } /* Check minimum tags threshold */ - if (part->html_features && part->html_features->tags_count < rule->min_html_tags) { + if (part->html->features.tags_count < rule->min_html_tags) { msg_debug_fuzzy_check("HTML part has %d tags, less than minimum %d", - part->html_features->tags_count, rule->min_html_tags); + part->html->features.tags_count, rule->min_html_tags); return NULL; } @@ -2278,17 +2278,15 @@ fuzzy_cmd_from_html_part(struct rspamd_task *task, * - Require at least 2 links (single-link emails too generic) * - Require at least some DOM depth (flat structure too common) */ - if (part->html_features) { - if (part->html_features->links.total_links < 2) { - msg_debug_fuzzy_check("HTML part has only %d links, too few for reliable matching", - part->html_features->links.total_links); - return NULL; - } - if (part->html_features->max_dom_depth < 3) { - msg_debug_fuzzy_check("HTML part has depth %d, too shallow for reliable matching", - part->html_features->max_dom_depth); - return NULL; - } + if (part->html->features.links.total_links < 2) { + msg_debug_fuzzy_check("HTML part has only %d links, too few for reliable matching", + part->html->features.links.total_links); + return NULL; + } + if (part->html->features.max_dom_depth < 3) { + msg_debug_fuzzy_check("HTML part has depth %d, too shallow for reliable matching", + part->html->features.max_dom_depth); + return NULL; } /*