summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-07-07 21:46:03 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2021-07-07 21:46:03 +0100
commit8617105c7cb7079ba20fa8aaf106b53abac278c3 (patch)
tree84850e78b159731dfb5b3955b10d0aa7b66b2667
parent2367a70d32a34ae044c209a76eafe605a820ae81 (diff)
downloadrspamd-8617105c7cb7079ba20fa8aaf106b53abac278c3.tar.gz
rspamd-8617105c7cb7079ba20fa8aaf106b53abac278c3.zip
[Minor] Fix entities with space decoding
-rw-r--r--src/libserver/html/html_entities.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libserver/html/html_entities.cxx b/src/libserver/html/html_entities.cxx
index 9ed080d4f..84e05953d 100644
--- a/src/libserver/html/html_entities.cxx
+++ b/src/libserver/html/html_entities.cxx
@@ -2474,6 +2474,11 @@ decode_html_entitles_inplace(char *s, std::size_t len, bool norm_spaces)
if ((*h == ';' || g_ascii_isspace(*h)) && h > e) {
replace_entity();
state = parser_state::normal_content;
+
+ if (g_ascii_isspace(*h)) {
+ /* Avoid increase of h */
+ continue;
+ }
}
else if (*h == '&') {
/* Previous `&` was bogus */
@@ -2580,7 +2585,7 @@ TEST_SUITE("html") {
{" abc def ", "abc def "},
{"FOO&gt;BAR", "FOO>BAR"},
{"FOO&gtBAR", "FOO>BAR"},
- {"FOO&gt BAR", "FOO>BAR"},
+ {"FOO&gt BAR", "FOO> BAR"},
{"FOO&gt;;;BAR", "FOO>;;BAR"},
{"I'm &notit;", "I'm ¬it;"},
{"I'm &notin;", "I'm ∉"},