aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver/url.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-10-14 12:22:17 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-10-14 12:22:17 +0100
commitc7cf4d68dbf5adb173f5a7391833cc9df8e2b4dd (patch)
treead4fcb1f07e1cd5e19598221dd08ace75f69ee01 /src/libserver/url.c
parent734f2591003d9873bb614d10da6a120caf9c1560 (diff)
downloadrspamd-c7cf4d68dbf5adb173f5a7391833cc9df8e2b4dd.tar.gz
rspamd-c7cf4d68dbf5adb173f5a7391833cc9df8e2b4dd.zip
[Fix] Fix some cases of TLD urls detector
Diffstat (limited to 'src/libserver/url.c')
-rw-r--r--src/libserver/url.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/libserver/url.c b/src/libserver/url.c
index 81908c41a..75b173c44 100644
--- a/src/libserver/url.c
+++ b/src/libserver/url.c
@@ -1809,6 +1809,7 @@ url_tld_end (struct url_callback_data *cb,
url_match_t *match)
{
const gchar *p;
+ gboolean ret = FALSE;
p = pos + match->m_len;
@@ -1822,12 +1823,12 @@ url_tld_end (struct url_callback_data *cb,
p = match->m_begin;
/* Check common prefix */
if (g_ascii_strncasecmp (p, "http://", sizeof ("http://") - 1) == 0) {
- return url_web_end (cb,
+ ret = url_web_end (cb,
match->m_begin + sizeof ("http://") - 1,
match);
}
else {
- return url_web_end (cb, match->m_begin, match);
+ ret = url_web_end (cb, match->m_begin, match);
}
}
@@ -1836,12 +1837,19 @@ url_tld_end (struct url_callback_data *cb,
if (p < cb->end) {
if (g_ascii_isspace (*p) || *p == '/' ||
*p == '?' || *p == ':') {
- return url_web_end (cb, match->m_begin, match);
+ ret = url_web_end (cb, match->m_begin, match);
}
}
}
- return FALSE;
+ if (ret) {
+ /* Check sanity of match found */
+ if (match->m_begin + match->m_len <= pos) {
+ return FALSE;
+ }
+ }
+
+ return ret;
}
static gboolean