From: Vsevolod Stakhov Date: Wed, 25 Aug 2021 16:32:58 +0000 (+0100) Subject: [Minor] Fix small href values with a base urls presented X-Git-Tag: 3.1~219 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e966950fb945eb2c5463dfcaa1fb197753003338;p=thirdparty%2Frspamd.git [Minor] Fix small href values with a base urls presented --- diff --git a/src/libserver/html/html.cxx b/src/libserver/html/html.cxx index 715f831d50..ef7fb35bab 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 +