From: Vsevolod Stakhov Date: Wed, 25 Apr 2018 17:31:04 +0000 (+0100) Subject: [Fix] Check URL before adding implicit prefix X-Git-Tag: 1.7.4~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ca2d20981bc6061df455f7f7a2ccb787ad595783;p=thirdparty%2Frspamd.git [Fix] Check URL before adding implicit prefix Issue: #2196 --- diff --git a/src/libserver/html.c b/src/libserver/html.c index 68bd4fc5a7..1ee012388d 100644 --- a/src/libserver/html.c +++ b/src/libserver/html.c @@ -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 */