[PATCH] ubus/lua: fix stack leak

nicola.pancheri at netduma.com nicola.pancheri at netduma.com
Fri Aug 27 04:22:26 PDT 2021


From: Nicola Pancheri <nicola.pancheri at netduma.com>

Fixes leak in the Lua stack; the call to lua_next in the loop pushes two
values to the stack, therefore both values should be popped off the
stack.

Signed-off-by: Nicola Pancheri <nicola.pancheri at netduma.com>
---
 lua/ubus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lua/ubus.c b/lua/ubus.c
index e2bb081..64fe338 100644
--- a/lua/ubus.c
+++ b/lua/ubus.c
@@ -238,7 +238,7 @@ ubus_lua_format_blob_array(lua_State *L, struct blob_buf *b, bool table)
 	{
 		if (!ubus_lua_format_blob(L, b, table))
 		{
-			lua_pop(L, 1);
+			lua_pop(L, 2);
 			return false;
 		}
 	}
-- 
2.25.1




More information about the openwrt-devel mailing list