From e966950fb945eb2c5463dfcaa1fb197753003338 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 25 Aug 2021 17:32:58 +0100 Subject: [PATCH] [Minor] Fix small href values with a base urls presented --- src/libserver/html/html.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libserver/html/html.cxx b/src/libserver/html/html.cxx index 715f831d5..ef7fb35ba 100644 --- a/src/libserver/html/html.cxx +++ b/src/libserver/html/html.cxx @@ -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 + -- 2.39.5