Sfoglia il codice sorgente

Fix TLD detection.

tags/0.9.0
Vsevolod Stakhov 9 anni fa
parent
commit
0c94da7bd8
1 ha cambiato i file con 4 aggiunte e 3 eliminazioni
  1. 4
    3
      src/libserver/url.c

+ 4
- 3
src/libserver/url.c Vedi File

@@ -894,16 +894,17 @@ rspamd_tld_trie_callback (int strnum, int textpos, void *context)
ndots = 2;
}

pos = url->host + textpos;
pos = url->host + textpos - pat->len;
start = url->host;

if (*pos != '.' || pos + pat->len != url->host + url->hostlen) {
if (*pos != '.' || textpos != (gint)url->hostlen) {
/* Something weird has been found */
return 0;
}

/* Now we need to find top level domain */
p = pos - 1;
pos = start;
while (p >= start && ndots > 0) {
if (*p == '.') {
ndots --;
@@ -913,7 +914,7 @@ rspamd_tld_trie_callback (int strnum, int textpos, void *context)
p --;
}

if (ndots == 0) {
if (ndots == 0 || p == start - 1) {
url->tld = (gchar *)pos;
url->tldlen = url->host + url->hostlen - pos;
}

Loading…
Annulla
Salva