commit 2f0052d: [Fix] Fix parsing of the compound mailto urls

Vsevolod Stakhov vsevolod at highsecure.ru
Wed Nov 17 21:56:05 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-11-17 21:54:30 +0000
URL: https://github.com/rspamd/rspamd/commit/2f0052dd9ee678437887ac0eea8cb1bee5cd7cee (HEAD -> master)

[Fix] Fix parsing of the compound mailto urls

---
 src/libserver/url.c | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/src/libserver/url.c b/src/libserver/url.c
index a56ee8b17..169b9b107 100644
--- a/src/libserver/url.c
+++ b/src/libserver/url.c
@@ -854,9 +854,30 @@ rspamd_mailto_parse (struct http_parser_url *u,
 				st = parse_query;
 				break;
 			case parse_query:
-				if (!is_mailsafe (t)) {
+				if (t == '#') {
+					if (p - c != 0) {
+						SET_U (u, UF_QUERY);
+					}
+					c = p + 1;
+					ret = 0;
+
 					goto out;
 				}
+				else if (!(parse_flags & RSPAMD_URL_PARSE_HREF) && is_url_end (t)) {
+					ret = 0;
+					goto out;
+				}
+				else if (is_lwsp (t)) {
+					if (!(parse_flags & RSPAMD_URL_PARSE_CHECK)) {
+						if (g_ascii_isspace (t)) {
+							ret = 0;
+						}
+						goto out;
+					}
+					else {
+						goto out;
+					}
+				}
 				p++;
 				break;
 		}


More information about the Commits mailing list