瀏覽代碼

[Fix] Try to avoid a corner case for `@` pattern

Issue: #4217
tags/3.3
Vsevolod Stakhov 1 年之前
父節點
當前提交
ca59cf9fcb
No account linked to committer's email address
共有 1 個文件被更改,包括 24 次插入15 次删除
  1. 24
    15
      src/libserver/url.c

+ 24
- 15
src/libserver/url.c 查看文件

} }


if (uri->tldlen == 0) { if (uri->tldlen == 0) {
if (!(parse_flags & RSPAMD_URL_PARSE_HREF)) {
/* Ignore URL's without TLD if it is not a numeric URL */
if (!rspamd_url_is_ip (uri, pool)) {
return URI_ERRNO_TLD_MISSING;
}
} else {
if (!rspamd_url_is_ip (uri, pool)) {
/* Assume tld equal to host */
uri->tldshift = uri->hostshift;
uri->tldlen = uri->hostlen;
}
else if (uri->flags & RSPAMD_URL_FLAG_SCHEMALESS) {
/* Ignore urls with both no schema and no tld */
return URI_ERRNO_TLD_MISSING;
if (uri->protocol != PROTOCOL_MAILTO) {
if (!(parse_flags & RSPAMD_URL_PARSE_HREF)) {
/* Ignore URL's without TLD if it is not a numeric URL */
if (!rspamd_url_is_ip(uri, pool)) {
return URI_ERRNO_TLD_MISSING;
}
} }
else {
if (!rspamd_url_is_ip(uri, pool)) {
/* Assume tld equal to host */
uri->tldshift = uri->hostshift;
uri->tldlen = uri->hostlen;
}
else if (uri->flags & RSPAMD_URL_FLAG_SCHEMALESS) {
/* Ignore urls with both no schema and no tld */
return URI_ERRNO_TLD_MISSING;
}


uri->flags |= RSPAMD_URL_FLAG_NO_TLD;
uri->flags |= RSPAMD_URL_FLAG_NO_TLD;
}
}
else {
/* Ignore IP like domains for mailto, as it is really never supported */
return URI_ERRNO_TLD_MISSING;
} }
} }


return FALSE; return FALSE;
} }


/* Check the next character after `@` */
if (!g_ascii_isalnum (pos[1]) || !g_ascii_isalnum (*(pos - 1))) { if (!g_ascii_isalnum (pos[1]) || !g_ascii_isalnum (*(pos - 1))) {
return FALSE; return FALSE;
} }



c = pos - 1; c = pos - 1;
while (c > cb->begin) { while (c > cb->begin) {
if (!is_mailsafe (*c)) { if (!is_mailsafe (*c)) {

Loading…
取消
儲存