summaryrefslogtreecommitdiffstats
path: root/src/lua/lua_text.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-11-19 11:34:03 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-11-19 11:34:03 +0000
commitff7c63b24d8e20fa4c75e408a5d29c44b154819f (patch)
tree27b916ae7e2ba71e665a85bb441cb91fb4d9c7bf /src/lua/lua_text.c
parent550c1905fe920aa857550317edd8e2961f087978 (diff)
downloadrspamd-ff7c63b24d8e20fa4c75e408a5d29c44b154819f.tar.gz
rspamd-ff7c63b24d8e20fa4c75e408a5d29c44b154819f.zip
[Minor] Fix some more lua compat issues with text:find
Diffstat (limited to 'src/lua/lua_text.c')
-rw-r--r--src/lua/lua_text.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lua/lua_text.c b/src/lua/lua_text.c
index dbbba9838..23e908c67 100644
--- a/src/lua/lua_text.c
+++ b/src/lua/lua_text.c
@@ -1358,12 +1358,14 @@ lua_text_find (lua_State *L)
init = relative_pos_start (lua_tointeger (L, 3), t->len);
}
+ init --;
+
if (init > t->len) {
return luaL_error (L, "invalid arguments to find: init too large");
}
- goffset pos = rspamd_substring_search (t->start + init - 1,
- t->len - (init - 1),
+ goffset pos = rspamd_substring_search (t->start + init,
+ t->len - init,
pat, patlen);
if (pos == -1) {