]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Fix entities with space decoding
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 7 Jul 2021 20:46:03 +0000 (21:46 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 7 Jul 2021 20:46:03 +0000 (21:46 +0100)
src/libserver/html/html_entities.cxx

index 9ed080d4f984b9c555280257dd6fd3ee5644da90..84e05953d2602e4640c4f2d90416caa10fd225f6 100644 (file)
@@ -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 ∉"},