aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-04-25 18:31:04 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-04-25 18:31:04 +0100
commitca2d20981bc6061df455f7f7a2ccb787ad595783 (patch)
tree4cf351343b2886801711a73cab1e60c23a552c85 /src
parenteb44a88a9405e9500e94c32395d69ab6460c4a9d (diff)
downloadrspamd-ca2d20981bc6061df455f7f7a2ccb787ad595783.tar.gz
rspamd-ca2d20981bc6061df455f7f7a2ccb787ad595783.zip
[Fix] Check URL before adding implicit prefix
Issue: #2196
Diffstat (limited to 'src')
-rw-r--r--src/libserver/html.c11
1 files 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 */