commit ba66d6a: [Fix] Fix lua_next invocation

Vsevolod Stakhov vsevolod at highsecure.ru
Thu Aug 6 11:07:06 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-08-06 12:05:43 +0100
URL: https://github.com/rspamd/rspamd/commit/ba66d6a5bb73f10515484315c6b676603cd0edf1

[Fix] Fix lua_next invocation

---
 src/plugins/fuzzy_check.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c
index d0faaed95..6a2ad3e07 100644
--- a/src/plugins/fuzzy_check.c
+++ b/src/plugins/fuzzy_check.c
@@ -2945,8 +2945,10 @@ fuzzy_generate_commands (struct rspamd_task *task, struct fuzzy_rule *rule,
 						lua_gettable (L, -2);
 
 						if (lua_type (L, -1) == LUA_TTABLE) {
+							gint tbl_pos = lua_gettop (L);
 
-							for (lua_pushnil (L); lua_next (L, 2); lua_pop (L, 1)) {
+							for (lua_pushnil (L); lua_next (L, tbl_pos);
+									lua_pop (L, 1)) {
 								const gchar *h = NULL;
 								gsize hlen = 0;
 


More information about the Commits mailing list