From ca2d20981bc6061df455f7f7a2ccb787ad595783 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 25 Apr 2018 18:31:04 +0100 Subject: [PATCH] [Fix] Check URL before adding implicit prefix Issue: #2196 --- src/libserver/html.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/libserver/html.c b/src/libserver/html.c index 68bd4fc5a..1ee012388 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 */ -- 2.39.5