commit 9647a70: [Minor] Fix multiple @ at the beginnig

Vsevolod Stakhov vsevolod at highsecure.ru
Wed May 12 16:21:04 UTC 2021


Author: Vsevolod Stakhov
Date: 2021-05-12 17:16:36 +0100
URL: https://github.com/rspamd/rspamd/commit/9647a701abfadd92a2975566cd19610c5810aa64 (HEAD -> master)

[Minor] Fix multiple @ at the beginnig

---
 src/libserver/url.c   | 4 ++++
 test/lua/unit/url.lua | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/src/libserver/url.c b/src/libserver/url.c
index 1fad034f5..2cfc7d147 100644
--- a/src/libserver/url.c
+++ b/src/libserver/url.c
@@ -1225,7 +1225,11 @@ rspamd_web_parse (struct http_parser_url *u, const gchar *str, gsize len,
 				}
 
 				/* For now, we ignore all that stuff as it is bogus */
+				/* Off by one */
+				p --;
 				SET_U (u, UF_USERINFO);
+				p ++;
+				*flags |= RSPAMD_URL_FLAG_HAS_USER;
 				st = parse_at;
 			}
 			else {
diff --git a/test/lua/unit/url.lua b/test/lua/unit/url.lua
index 40d684bfc..282d79290 100644
--- a/test/lua/unit/url.lua
+++ b/test/lua/unit/url.lua
@@ -136,6 +136,9 @@ context("URL check functions", function()
     {"http:////$%^&****((@example.org//#f@f", true, {
       user = '$%^&****((', host = 'example.org', fragment = 'f at f'
     }},
+    {"http://@@example.com", true, {
+      user = "@", host = "example.com"
+    }}
   }
 
   -- Some cases from https://code.google.com/p/google-url/source/browse/trunk/src/url_canon_unittest.cc


More information about the Commits mailing list