From: Vsevolod Stakhov Date: Wed, 2 Oct 2019 11:39:31 +0000 (+0100) Subject: [Minor] Fix telephones parsing X-Git-Tag: 2.0~84 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8c6cb8b6ba54ade58ae9f66f48eb6b20b4057f2d;p=rspamd.git [Minor] Fix telephones parsing --- diff --git a/src/libserver/url.c b/src/libserver/url.c index 1ea68dede..a306ce8c7 100644 --- a/src/libserver/url.c +++ b/src/libserver/url.c @@ -877,7 +877,7 @@ rspamd_telephone_parse (struct http_parser_url *u, if (u_isdigit (uc) || uc == '(' || uc == ')' || uc == '[' || uc == ']' || u_isspace (uc) || uc == '%') { - p ++; + /* p is already incremented by U8_NEXT! */ } else if (uc <= 0 || is_url_end (uc)) { ret = 0; @@ -1983,9 +1983,12 @@ rspamd_url_parse (struct rspamd_url *uri, uri->flags |= RSPAMD_URL_FLAG_UNNORMALISED; } - /* Ensure that hostname starts with something sane (exclude numeric urls) */ - if (!(is_domain_start (uri->host[0]) || uri->host[0] == ':')) { - return URI_ERRNO_BAD_FORMAT; + + if (uri->protocol & (PROTOCOL_HTTP|PROTOCOL_HTTPS|PROTOCOL_MAILTO|PROTOCOL_FTP|PROTOCOL_FILE)) { + /* Ensure that hostname starts with something sane (exclude numeric urls) */ + if (!(is_domain_start (uri->host[0]) || uri->host[0] == ':')) { + return URI_ERRNO_BAD_FORMAT; + } } rspamd_url_shift (uri, unquoted_len, UF_HOST);