commit 7f8d761: [Minor] One more fix in the ZW spaces urls processing logic

Vsevolod Stakhov vsevolod at highsecure.ru
Thu May 13 20:42:03 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-05-13 21:23:18 +0100
URL: https://github.com/rspamd/rspamd/commit/7f8d761d3a998c5f7b9912a430e760fb93f25032

[Minor] One more fix in the ZW spaces urls processing logic

---
 src/libserver/html.c | 11 ++---------
 src/libserver/url.c  |  2 +-
 2 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/src/libserver/html.c b/src/libserver/html.c
index c373bb115..ec46f30c1 100644
--- a/src/libserver/html.c
+++ b/src/libserver/html.c
@@ -2609,7 +2609,6 @@ rspamd_html_check_displayed_url (rspamd_mempool_t *pool,
 	struct rspamd_url *turl;
 	gboolean url_found = FALSE;
 	struct rspamd_process_exception *ex;
-	enum rspamd_normalise_result norm_res;
 	guint saved_flags = 0;
 	gsize dlen;
 
@@ -2625,14 +2624,6 @@ rspamd_html_check_displayed_url (rspamd_mempool_t *pool,
 	url->visible_part =
 			(gchar *)rspamd_string_len_strip (url->visible_part, &dlen, " \t\v\r\n");
 
-	norm_res = rspamd_normalise_unicode_inplace (pool, url->visible_part, &dlen);
-
-	if (norm_res & RSPAMD_UNICODE_NORM_UNNORMAL) {
-		saved_flags |= RSPAMD_URL_FLAG_UNNORMALISED;
-	}
-	if (norm_res & RSPAMD_UNICODE_NORM_ZERO_SPACES) {
-		saved_flags |= RSPAMD_URL_FLAG_ZW_SPACES;
-	}
 
 	rspamd_html_url_is_phished (pool, url,
 			url->visible_part,
@@ -2678,6 +2669,8 @@ rspamd_html_check_displayed_url (rspamd_mempool_t *pool,
 			/* Already inserted by `rspamd_url_set_add_or_return` */
 		}
 	}
+
+	rspamd_normalise_unicode_inplace (pool, url->visible_part, &dlen);
 }
 
 static gboolean
diff --git a/src/libserver/url.c b/src/libserver/url.c
index 01973a75a..726f9b7f8 100644
--- a/src/libserver/url.c
+++ b/src/libserver/url.c
@@ -1369,7 +1369,7 @@ rspamd_web_parse (struct http_parser_url *u, const gchar *str, gsize len,
 						if (!u_isalnum (uc)) {
 							/* Bad symbol */
 							if (IS_ZERO_WIDTH_SPACE (uc)) {
-								(*flags) |= RSPAMD_URL_FLAG_OBSCURED|RSPAMD_URL_FLAG_ZW_SPACES;
+								(*flags) |= RSPAMD_URL_FLAG_ZW_SPACES;
 							}
 							else {
 								if (!u_isgraph (uc)) {


More information about the Commits mailing list