]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Fix boundary detection in emails checks
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 18 Feb 2020 17:38:42 +0000 (17:38 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 18 Feb 2020 17:38:42 +0000 (17:38 +0000)
src/libserver/url.c

index 52af7ca272a481acd2c40a80ff63dd990d9049a5..dcf13cfda476a2d789edc21687a677444f83391c 100644 (file)
@@ -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;
                }