summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-12-02 17:16:14 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-12-02 17:16:14 +0000
commitece601117f3aeb020faf80a307d54ef356411bd0 (patch)
tree70a25edd98f3a15d7cc246b34da6860137cbd160
parent09c3e1b85633c1541555b1fdd74f814b2a0ff930 (diff)
downloadrspamd-ece601117f3aeb020faf80a307d54ef356411bd0.tar.gz
rspamd-ece601117f3aeb020faf80a307d54ef356411bd0.zip
Fix parsing of url encoded href tags
-rw-r--r--src/libserver/html.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libserver/html.c b/src/libserver/html.c
index 45eeb8e4a..29922b133 100644
--- a/src/libserver/html.c
+++ b/src/libserver/html.c
@@ -1285,7 +1285,9 @@ rspamd_html_process_url_tag (rspamd_mempool_t *pool, struct html_tag *tag)
struct rspamd_url *url;
GList *cur;
const guchar *p;
+ gchar *decoded;
gint rc;
+ gsize decoded_len;
gboolean has_spaces = FALSE;
cur = tag->params->head;
@@ -1313,8 +1315,13 @@ rspamd_html_process_url_tag (rspamd_mempool_t *pool, struct html_tag *tag)
has_spaces = TRUE;
}
+ /* Also we need to perform url decode */
+ decoded = rspamd_mempool_alloc (pool, comp->len + 1);
+ rspamd_strlcpy (decoded, comp->start, comp->len + 1);
+ decoded_len = rspamd_decode_url (decoded, comp->start, comp->len);
+
url = rspamd_mempool_alloc (pool, sizeof (*url));
- rc = rspamd_url_parse (url, (gchar *)comp->start, comp->len, pool);
+ rc = rspamd_url_parse (url, decoded, decoded_len, pool);
if (rc == URI_ERRNO_OK) {