commit db425a9: [Minor] Stop extracting urls on limit reached
Vsevolod Stakhov
vsevolod at highsecure.ru
Mon Dec 23 18:49:15 UTC 2019
Author: Vsevolod Stakhov
Date: 2019-12-23 17:43:39 +0000
URL: https://github.com/rspamd/rspamd/commit/db425a97b301299cc0d2cb732a5e266e83216299
[Minor] Stop extracting urls on limit reached
---
src/libserver/url.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/libserver/url.c b/src/libserver/url.c
index 29ea4f633..6f5b767c4 100644
--- a/src/libserver/url.c
+++ b/src/libserver/url.c
@@ -3044,6 +3044,17 @@ rspamd_url_text_part_callback (struct rspamd_url *url, gsize start_offset,
}
if (target_tbl) {
+ /* Also check max urls */
+ if (cbd->task->cfg && cbd->task->cfg->max_lua_urls > 0) {
+ if (g_hash_table_size (target_tbl) > cbd->task->cfg->max_lua_urls) {
+ msg_err_task ("part has too many URLs, we cannot process more: "
+ "%z urls extracted ",
+ g_hash_table_size (target_tbl));
+
+ return FALSE;
+ }
+ }
+
if ((existing = g_hash_table_lookup (target_tbl, url)) == NULL) {
url->flags |= RSPAMD_URL_FLAG_FROM_TEXT;
g_hash_table_insert (target_tbl, url, url);
More information about the Commits
mailing list