commit 8c6cb8b: [Minor] Fix telephones parsing
Vsevolod Stakhov
vsevolod at highsecure.ru
Wed Oct 2 11:42:06 UTC 2019
Author: Vsevolod Stakhov
Date: 2019-10-02 12:39:31 +0100
URL: https://github.com/rspamd/rspamd/commit/8c6cb8b6ba54ade58ae9f66f48eb6b20b4057f2d (HEAD -> master)
[Minor] Fix telephones parsing
---
src/libserver/url.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
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);
More information about the Commits
mailing list