]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Fix small href values with a base urls presented
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 25 Aug 2021 16:32:58 +0000 (17:32 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 25 Aug 2021 16:32:58 +0000 (17:32 +0100)
src/libserver/html/html.cxx

index 715f831d506a4b0b7adc8512809afd4b960b6ba8..ef7fb35bab9b43607555c58ec5b3a0619f889342 100644 (file)
@@ -603,7 +603,7 @@ html_process_url_tag(rspamd_mempool_t *pool,
                /* Check base url */
                auto &href_value = found_href_maybe.value();
 
-               if (hc && hc->base_url && href_value.size() > 2) {
+               if (hc && hc->base_url) {
                        /*
                         * Relative url cannot start from the following:
                         * schema://
@@ -638,7 +638,7 @@ html_process_url_tag(rspamd_mempool_t *pool,
                                                (gint) orig_len, href_value.data());
                                href_value = {buf, nlen};
                        }
-                       else if (href_value[0] == '/' && href_value[1] != '/') {
+                       else if (href_value.size() > 2 && href_value[0] == '/' && href_value[1] != '/') {
                                /* Relative to the hostname */
                                auto orig_len = href_value.size();
                                auto len = orig_len + hc->base_url->hostlen + hc->base_url->protocollen +