From: Timo Sirainen Date: Wed, 2 Jun 2021 16:48:48 +0000 (+0300) Subject: lib-lua: dlua_table_get() - Pop key from stack if idx doesn't point to a table X-Git-Tag: 2.4.0~4808 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0e34c94f406fb4f88db27fb4054946a8671085e9;p=thirdparty%2Fdovecot%2Fcore.git lib-lua: dlua_table_get() - Pop key from stack if idx doesn't point to a table Otherwise it leaks the key into the stack. --- diff --git a/src/lib-lua/dlua-table.c b/src/lib-lua/dlua-table.c index 8467a7e695..74afa1e6eb 100644 --- a/src/lib-lua/dlua-table.c +++ b/src/lib-lua/dlua-table.c @@ -37,8 +37,10 @@ static inline int adj(int idx, int delta) static int dlua_table_get(lua_State *L, int idx, int type) { /* can only work with tables */ - if (!lua_istable(L, idx)) + if (!lua_istable(L, idx)) { + lua_pop(L, 1); return -1; + } lua_gettable(L, idx);