commit 096eecc: [Minor] Fix boundary detection in emails checks

Vsevolod Stakhov vsevolod at highsecure.ru
Tue Feb 18 17:42:06 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-02-18 17:38:42 +0000
URL: https://github.com/rspamd/rspamd/commit/096eecc613be507c60f25dd54f60eb5b4c7a1fff (HEAD -> master)

[Minor] Fix boundary detection in emails checks

---
 src/libserver/url.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/libserver/url.c b/src/libserver/url.c
index 52af7ca27..dcf13cfda 100644
--- a/src/libserver/url.c
+++ b/src/libserver/url.c
@@ -2580,6 +2580,12 @@ url_email_start (struct url_callback_data *cb,
 		/* We have mailto:// at the beginning */
 		match->m_begin = pos;
 
+		if (pos >= cb->begin + 1) {
+			match->st = *(pos - 1);
+		}
+		else {
+			match->st = '\0';
+		}
 	}
 	else {
 		/* Just '@' */
@@ -2593,12 +2599,7 @@ url_email_start (struct url_callback_data *cb,
 			/* Just @ at the start of input */
 			return FALSE;
 		}
-	}
 
-	if (pos >= cb->begin + 1) {
-		match->st = *(pos - 1);
-	}
-	else {
 		match->st = '\0';
 	}
 
@@ -2647,7 +2648,7 @@ url_email_end (struct url_callback_data *cb,
 		 */
 		g_assert (*pos == '@');
 
-		if (pos >= cb->end - 2 || pos <= cb->begin + 1) {
+		if (pos >= cb->end - 2 || pos < cb->begin + 1) {
 			/* Boundary violation */
 			return FALSE;
 		}


More information about the Commits mailing list