From: Vsevolod Stakhov Date: Mon, 23 Dec 2019 17:43:39 +0000 (+0000) Subject: [Minor] Stop extracting urls on limit reached X-Git-Tag: 2.3~182 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=db425a97b301299cc0d2cb732a5e266e83216299;p=rspamd.git [Minor] Stop extracting urls on limit reached --- 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);