From db425a97b301299cc0d2cb732a5e266e83216299 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 23 Dec 2019 17:43:39 +0000 Subject: [PATCH] [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); -- 2.39.5