diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-03-19 18:24:09 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-03-19 18:24:09 +0000 |
commit | 7fb50e6f4c0c000c52ac927c7a95f5d3349a8b8b (patch) | |
tree | a72859d471154f478b93ccabe33d44c4ba45e1b5 | |
parent | 3a344136cc275fa2e0879d10e6ef119e882b58c9 (diff) | |
download | rspamd-7fb50e6f4c0c000c52ac927c7a95f5d3349a8b8b.tar.gz rspamd-7fb50e6f4c0c000c52ac927c7a95f5d3349a8b8b.zip |
Add global limit for mime regular expressions.
-rw-r--r-- | src/libmime/mime_expressions.c | 10 | ||||
-rw-r--r-- | src/libmime/mime_expressions.h | 7 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/libmime/mime_expressions.c b/src/libmime/mime_expressions.c index acc2caf0a..ad2f5e34b 100644 --- a/src/libmime/mime_expressions.c +++ b/src/libmime/mime_expressions.c @@ -143,6 +143,7 @@ static struct _fl *list_ptr = &rspamd_functions_list[0]; static guint32 functions_number = sizeof (rspamd_functions_list) / sizeof (struct _fl); static gboolean list_allocated = FALSE; +static guint max_re_data = 0; /* Bsearch routine */ static gint @@ -1257,3 +1258,12 @@ rspamd_has_fake_html (struct rspamd_task * task, GList * args, void *unused) return res; } + +guint +rspamd_mime_expression_set_re_limit (guint limit) +{ + guint ret = max_re_data; + + max_re_data = limit; + return ret; +} diff --git a/src/libmime/mime_expressions.h b/src/libmime/mime_expressions.h index ea00bc278..27050ed19 100644 --- a/src/libmime/mime_expressions.h +++ b/src/libmime/mime_expressions.h @@ -57,4 +57,11 @@ void task_cache_add (struct rspamd_task *task, */ gint32 task_cache_check (struct rspamd_task *task, struct rspamd_regexp_element *re); +/** + * Set global limit of regexp data size to be processed + * @param limit new limit in bytes + * @return old limit value + */ +guint rspamd_mime_expression_set_re_limit (guint limit); + #endif |