commit e966950: [Minor] Fix small href values with a base urls presented

Vsevolod Stakhov vsevolod at highsecure.ru
Wed Aug 25 16:35:04 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-08-25 17:32:58 +0100
URL: https://github.com/rspamd/rspamd/commit/e966950fb945eb2c5463dfcaa1fb197753003338 (HEAD -> master)

[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 +


More information about the Commits mailing list