commit 6897263: [Minor] Fix support of attributes with no values

Vsevolod Stakhov vsevolod at highsecure.ru
Sun Jul 11 09:42:05 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-07-11 10:38:38 +0100
URL: https://github.com/rspamd/rspamd/commit/68972636b2f349ceca63f47e4f2ab739a81e43bc (HEAD -> master)

[Minor] Fix support of attributes with no values

---
 src/libserver/html/html.cxx | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/libserver/html/html.cxx b/src/libserver/html/html.cxx
index 28f26ec65..05c70716e 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 == '<') {


More information about the Commits mailing list