diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-11-19 11:34:03 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-11-19 11:34:03 +0000 |
commit | ff7c63b24d8e20fa4c75e408a5d29c44b154819f (patch) | |
tree | 27b916ae7e2ba71e665a85bb441cb91fb4d9c7bf /src/lua/lua_text.c | |
parent | 550c1905fe920aa857550317edd8e2961f087978 (diff) | |
download | rspamd-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.c | 6 |
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) { |