]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] Check URL before adding implicit prefix
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 25 Apr 2018 17:31:04 +0000 (18:31 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 25 Apr 2018 17:31:04 +0000 (18:31 +0100)
Issue: #2196

src/libserver/html.c

index 68bd4fc5a7bbd33b79afdd3d8a82623704f44478..1ee012388d442a90cba31cc30d2bb9c2078ddeb9 100644 (file)
@@ -1535,8 +1535,15 @@ rspamd_html_process_url (rspamd_mempool_t *pool, const gchar *start, guint len,
        d = decoded;
 
        if (no_prefix) {
-               memcpy (d, "http://", sizeof ("http://") - 1);
-               d += sizeof ("http://") - 1;
+               if (s[0] == '/' && (len > 2 && s[1] == '/')) {
+                       /* //bla case */
+                       memcpy (d, "http:", sizeof ("http:") - 1);
+                       d += sizeof ("http:") - 1;
+               }
+               else {
+                       memcpy (d, "http://", sizeof ("http://") - 1);
+                       d += sizeof ("http://") - 1;
+               }
        }
 
        /* We also need to remove all internal newlines and encode unsafe characters */