Skip to content

Commit

Permalink
[Minor] Allow to call function from stack in rspamd_lua_universal_pcall
Browse files Browse the repository at this point in the history
  • Loading branch information
vstakhov committed Aug 7, 2023
1 parent 1e84018 commit 9964353
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/lua/lua_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -2555,7 +2555,13 @@ bool rspamd_lua_universal_pcall(lua_State *L, gint cbref, const gchar *strloc,

va_start(ap, err);
/* Called function */
lua_rawgeti(L, LUA_REGISTRYINDEX, cbref);
if (cbref > 0) {
lua_rawgeti(L, LUA_REGISTRYINDEX, cbref);
}
else {
/* Assume that function was on top of the stack */
lua_pushvalue(L, err_idx - 1);
}
/*
* Possible arguments
* - i - lua_integer, argument - gint64
Expand Down

0 comments on commit 9964353

Please sign in to comment.