From 2824bad75455744e6966a202e0ec80f8fa6d0498 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 1 Jul 2015 16:34:14 +0100 Subject: [PATCH] Fix parsing of multiple slashes in URL. --- src/libserver/url.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/libserver/url.c b/src/libserver/url.c index 17237f37e..e5de2fc98 100644 --- a/src/libserver/url.c +++ b/src/libserver/url.c @@ -451,10 +451,14 @@ rspamd_mailto_parse (struct http_parser_url *u, const gchar *str, gsize len, st = parse_prefix_question; p ++; } - else { + else if (t != '/') { c = p; st = parse_user; } + else { + /* Skip multiple slashes */ + p ++; + } break; case parse_prefix_question: if (t == 't') { @@ -608,14 +612,21 @@ rspamd_web_parse (struct http_parser_url *u, const gchar *str, gsize len, p ++; break; case parse_slash_slash: - c = p; - st = parse_domain; - slash = p; - if (*p == '[') { - st = parse_ipv6; - p ++; + if (t != '/') { c = p; + st = parse_domain; + slash = p; + + if (*p == '[') { + st = parse_ipv6; + p ++; + c = p; + } + } + else { + /* Skip multiple slashes */ + p ++; } break; case parse_ipv6: -- 2.39.5