aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver/url.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-10-21 12:07:58 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-10-21 12:07:58 +0100
commit3f430ffcbb369c1b05cf62af5e1eabfdf7c46891 (patch)
tree700c5cf437d712e115c9ea6d684763598ca1663a /src/libserver/url.c
parenta7e0eda40297ccf47ae7d39fe4594d4048c83da9 (diff)
downloadrspamd-3f430ffcbb369c1b05cf62af5e1eabfdf7c46891.tar.gz
rspamd-3f430ffcbb369c1b05cf62af5e1eabfdf7c46891.zip
[Fix] Fix emails detection
MFH: rspamd-1.6
Diffstat (limited to 'src/libserver/url.c')
-rw-r--r--src/libserver/url.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/libserver/url.c b/src/libserver/url.c
index 4d458e15a..ef04df04e 100644
--- a/src/libserver/url.c
+++ b/src/libserver/url.c
@@ -2111,7 +2111,14 @@ url_email_end (struct url_callback_data *cb,
}
c = pos - 1;
- while (c > cb->begin && is_mailsafe (*c)) {
+ while (c > cb->begin) {
+ if (!is_mailsafe (*c)) {
+ break;
+ }
+ if (c == match->prev_newline_pos) {
+ break;
+ }
+
c --;
}
/* Rewind to the first alphanumeric character */
@@ -2122,14 +2129,19 @@ url_email_end (struct url_callback_data *cb,
/* Find the end of email */
p = pos + 1;
while (p < cb->end && is_domain (*p)) {
+ if (p == match->newline_pos) {
+ break;
+ }
+
p ++;
}
+
/* Rewind it again to avoid bad emails to be detected */
while (p > pos && p < cb->end && !g_ascii_isalnum (*p)) {
p --;
}
- if (p < cb->end && g_ascii_isalnum (*p)) {
+ if (p < cb->end && p < match->newline_pos && g_ascii_isalnum (*p)) {
p ++;
}