summaryrefslogtreecommitdiffstats
path: root/src/lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-08-24 16:19:25 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2021-08-24 16:19:25 +0100
commit2802836b8a2fb32ed46f943d96d882633b714196 (patch)
treec23ba359324adf2e9714cc3b16d2e9f59455600a /src/lua
parent94f656018d8e26ffe7b91897ee159001ab4c3a5f (diff)
downloadrspamd-2802836b8a2fb32ed46f943d96d882633b714196.tar.gz
rspamd-2802836b8a2fb32ed46f943d96d882633b714196.zip
[Minor] Fix match limit feature in regexps
Diffstat (limited to 'src/lua')
-rw-r--r--src/lua/lua_common.h1
-rw-r--r--src/lua/lua_regexp.c21
2 files changed, 2 insertions, 20 deletions
diff --git a/src/lua/lua_common.h b/src/lua/lua_common.h
index 66403ecfe..d9e4fcaec 100644
--- a/src/lua/lua_common.h
+++ b/src/lua/lua_common.h
@@ -126,7 +126,6 @@ struct rspamd_lua_regexp {
rspamd_regexp_t *re;
gchar *module;
gchar *re_pattern;
- gsize match_limit;
gint re_flags;
};
diff --git a/src/lua/lua_regexp.c b/src/lua/lua_regexp.c
index bd3706d16..92ed1d790 100644
--- a/src/lua/lua_regexp.c
+++ b/src/lua/lua_regexp.c
@@ -399,10 +399,10 @@ lua_regexp_set_limit (lua_State *L)
if (re && re->re && !IS_DESTROYED (re)) {
if (lim > 0) {
- re->match_limit = lim;
+ rspamd_regexp_set_match_limit(re->re, lim);
}
else {
- re->match_limit = 0;
+ rspamd_regexp_set_match_limit(re->re, 0);
}
}
@@ -522,10 +522,6 @@ lua_regexp_search (lua_State *L)
lua_newtable (L);
i = 0;
- if (re->match_limit > 0) {
- len = MIN (len, re->match_limit);
- }
-
while (rspamd_regexp_search (re->re, data, len, &start, &end, raw,
captures)) {
@@ -605,10 +601,6 @@ lua_regexp_match (lua_State *L)
}
if (data && len > 0) {
- if (re->match_limit > 0) {
- len = MIN (len, re->match_limit);
- }
-
if (rspamd_regexp_search (re->re, data, len, NULL, NULL, raw, NULL)) {
lua_pushboolean (L, TRUE);
}
@@ -670,11 +662,6 @@ lua_regexp_matchn (lua_State *L)
}
if (data && len > 0) {
-
- if (re->match_limit > 0) {
- len = MIN (len, re->match_limit);
- }
-
for (;;) {
if (rspamd_regexp_search (re->re, data, len, &start, &end, raw,
NULL)) {
@@ -740,10 +727,6 @@ lua_regexp_split (lua_State *L)
is_text = TRUE;
}
- if (re->match_limit > 0) {
- len = MIN (len, re->match_limit);
- }
-
if (data && len > 0) {
lua_newtable (L);
i = 0;