commit 6b15d1e: [Minor] Truncate too long urls instead of discarding them completely
Vsevolod Stakhov
vsevolod at highsecure.ru
Thu Apr 15 15:07:04 UTC 2021
Author: Vsevolod Stakhov
Date: 2021-04-15 15:39:33 +0100
URL: https://github.com/rspamd/rspamd/commit/6b15d1ed13c0e082d25097f4833e9d533b753678
[Minor] Truncate too long urls instead of discarding them completely
---
src/libserver/url.c | 3 ++-
src/libserver/url.h | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/libserver/url.c b/src/libserver/url.c
index 01bb527f0..ad77686b7 100644
--- a/src/libserver/url.c
+++ b/src/libserver/url.c
@@ -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;
diff --git a/src/libserver/url.h b/src/libserver/url.h
index fe3124308..30c5ef0af 100644
--- a/src/libserver/url.h
+++ b/src/libserver/url.h
@@ -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 {
More information about the Commits
mailing list