From: Timo Sirainen Date: Thu, 22 Aug 2024 14:20:30 +0000 (+0300) Subject: lib-lua: dlua_check_event() - Fix calling with negative arg X-Git-Tag: 2.4.0~1489 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7669f30c320dbb4f9945c6ebffc61fe5b187d45a;p=thirdparty%2Fdovecot%2Fcore.git lib-lua: dlua_check_event() - Fix calling with negative arg --- diff --git a/src/lib-lua/dlua-dovecot.c b/src/lib-lua/dlua-dovecot.c index 5f23de151b..df382ddd30 100644 --- a/src/lib-lua/dlua-dovecot.c +++ b/src/lib-lua/dlua-dovecot.c @@ -258,6 +258,8 @@ struct event *dlua_check_event(lua_State *L, int arg) lua_typename(L, lua_type(L, arg))); } lua_pushliteral(L, "item"); + if (arg < 0) + arg--; lua_rawget(L, arg); struct event **bp = (void*)lua_touserdata(L, -1); lua_pop(L, 1);