]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Truncate too long urls instead of discarding them completely
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 15 Apr 2021 14:39:33 +0000 (15:39 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 15 Apr 2021 14:39:33 +0000 (15:39 +0100)
src/libserver/url.c
src/libserver/url.h

index 01bb527f09870fa592b815ccd0dae6baaa2a0fb9..ad77686b792b5b347a8559e99e68602fffe22d27 100644 (file)
@@ -2190,7 +2190,8 @@ rspamd_url_parse (struct rspamd_url *uri,
        }
 
        if (len >= G_MAXUINT16 / 2) {
-               return URI_ERRNO_TOO_LONG;
+               flags |= RSPAMD_URL_FLAG_TRUNCATED;
+               len = G_MAXUINT16 / 2;
        }
 
        p = uristring;
index fe3124308c13d1ffd77877ac3a070b3026220f2f..30c5ef0afb87bd3244e3a0cdbe7b7d6db0671fa4 100644 (file)
@@ -38,6 +38,7 @@ enum rspamd_url_flags {
        RSPAMD_URL_FLAG_QUERY = 1u << 20u,
        RSPAMD_URL_FLAG_CONTENT = 1u << 21u,
        RSPAMD_URL_FLAG_NO_TLD = 1u << 22u,
+       RSPAMD_URL_FLAG_TRUNCATED = 1u << 23u,
 };
 
 struct rspamd_url_tag {