]> source.dussan.org Git - rspamd.git/commitdiff
Fix parsing of multiple slashes in URL.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 1 Jul 2015 15:34:14 +0000 (16:34 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 2 Jul 2015 10:42:09 +0000 (11:42 +0100)
src/libserver/url.c

index 17237f37ee12914975d25c14004e63195250f8dc..e5de2fc9800c75db7fef18907199a0ad4df4eb51 100644 (file)
@@ -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: