aboutsummaryrefslogtreecommitdiffstats
path: root/src/url.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2012-08-22 22:09:46 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2012-08-22 22:09:46 +0400
commit5767620cc4e05b08440c144f6f7377470e9d7b71 (patch)
tree94325e191e3139bb3df593a895a6ea031cee8504 /src/url.c
parentb90267a71cc8cdc8b38675322ef9fa7a9cb5468c (diff)
downloadrspamd-5767620cc4e05b08440c144f6f7377470e9d7b71.tar.gz
rspamd-5767620cc4e05b08440c144f6f7377470e9d7b71.zip
Fix url detector.
Diffstat (limited to 'src/url.c')
-rw-r--r--src/url.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/url.c b/src/url.c
index 803bd05fd..764e56298 100644
--- a/src/url.c
+++ b/src/url.c
@@ -1232,7 +1232,12 @@ url_tld_start (const gchar *begin, const gchar *end, const gchar *pos, url_match
/* Try to find the start of the url by finding any non-urlsafe character or whitespace/punctuation */
while (p >= begin) {
- if (!is_urlsafe (*p) || g_ascii_isspace (*p)) {
+ if ((!is_domain (*p) && *p != '.') || g_ascii_isspace (*p)) {
+ p ++;
+ if (*p == '.') {
+ /* Urls cannot start with . */
+ return FALSE;
+ }
match->m_begin = p;
return TRUE;
}
@@ -1277,6 +1282,10 @@ url_web_start (const gchar *begin, const gchar *end, const gchar *pos, url_match
return FALSE;
}
}
+ if (*pos == '.') {
+ /* Urls cannot start with . */
+ return FALSE;
+ }
match->m_begin = pos;
return TRUE;