From: Vsevolod Stakhov Date: Sun, 11 Jul 2021 09:38:38 +0000 (+0100) Subject: [Minor] Fix support of attributes with no values X-Git-Tag: 3.0~183 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68972636b2f349ceca63f47e4f2ab739a81e43bc;p=thirdparty%2Frspamd.git [Minor] Fix support of attributes with no values --- diff --git a/src/libserver/html/html.cxx b/src/libserver/html/html.cxx index 28f26ec652..05c70716e8 100644 --- a/src/libserver/html/html.cxx +++ b/src/libserver/html/html.cxx @@ -368,7 +368,9 @@ html_parse_tag_content(rspamd_mempool_t *pool, case parse_attr_name: if (*in == '=') { - store_component_name(); + if (!parser_env.buf.empty()) { + store_component_name(); + } state = parse_equal; } else if (g_ascii_isspace(*in)) { @@ -377,11 +379,13 @@ html_parse_tag_content(rspamd_mempool_t *pool, } else if (*in == '/') { store_component_name(); + store_component_value(); tag->flags |= FL_CLOSED; state = spaces_before_eq; } else if (*in == '>') { store_component_name(); + store_component_value(); state = tag_end; } else { @@ -414,6 +418,7 @@ html_parse_tag_content(rspamd_mempool_t *pool, * Should be okay (empty attribute). The rest is handled outside * this automata. */ + store_component_value(); state = tag_end; } else if (*in == '"' || *in == '\'' || *in == '<') {