]> source.dussan.org Git - rspamd.git/commitdiff
Fix urls detection for strings with multiply dots.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 24 Jun 2013 11:32:54 +0000 (12:32 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 24 Jun 2013 11:32:54 +0000 (12:32 +0100)
src/url.c

index eb03198d7d80274b790978acbfcf1b96a90032f4..2cbd047aad14e87cc937043e7d260f55f92c7372 100644 (file)
--- a/src/url.c
+++ b/src/url.c
@@ -1217,6 +1217,16 @@ url_tld_start (const gchar *begin, const gchar *end, const gchar *pos, url_match
                        match->m_begin = p;
                        return TRUE;
                }
+               else if (*p == '.') {
+                       if (p == begin) {
+                               /* Urls cannot start with a dot */
+                               return FALSE;
+                       }
+                       if (!g_ascii_isalnum (p[1])) {
+                               /* Wrong we have an invalid character after dot */
+                               return FALSE;
+                       }
+               }
                p --;
        }