From 3aa1abc4cabaa77bd9d3d05064466990d7e68a59 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Thu, 18 Nov 2021 11:53:17 +0200 Subject: [PATCH] Fix some Lua stack leaks in our initialization code --- rpmio/rpmlua.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rpmio/rpmlua.c b/rpmio/rpmlua.c index 8459cd8..6ad9119 100644 --- a/rpmio/rpmlua.c +++ b/rpmio/rpmlua.c @@ -131,14 +131,18 @@ rpmlua rpmluaNew() for (lib = extlibs; lib->name; lib++) { luaL_requiref(L, lib->name, lib->func, 1); + lua_pop(L, 1); } lua_pushcfunction(L, rpm_print); lua_setglobal(L, "print"); lua_getglobal(L, "os"); luaL_setfuncs(L, os_overrides, 0); + lua_pop(L, 1); + lua_getglobal(L, "posix"); luaL_setfuncs(L, posix_overrides, 0); + lua_pop(L, 1); lua_getglobal(L, "package"); lua_pushfstring(L, "%s/%s", rpmConfigDir(), "/lua/?.lua"); -- 1.8.3.1