Date: Tue, 2 Mar 2021 23:33:44 GMT From: Ryan Moeller <freqlabs@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: e175b519a6fb - main - lib/flua/libjail: Allow empty params table Message-ID: <202103022333.122NXi9w001477@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=e175b519a6fb83889fb3ca679b73d11ea5bea7ad commit e175b519a6fb83889fb3ca679b73d11ea5bea7ad Author: Ryan Moeller <freqlabs@FreeBSD.org> AuthorDate: 2021-02-25 05:16:52 +0000 Commit: Ryan Moeller <freqlabs@FreeBSD.org> CommitDate: 2021-03-02 23:32:22 +0000 lib/flua/libjail: Allow empty params table The name or jid always gets added to the params, and that's enough to avoid allocating a 0 length params array. Reported by: kevans Reviewed by: kevans MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28778 --- lib/flua/libjail/lua_jail.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/flua/libjail/lua_jail.c b/lib/flua/libjail/lua_jail.c index 9981fd5421c6..b66c60b43bc8 100644 --- a/lib/flua/libjail/lua_jail.c +++ b/lib/flua/libjail/lua_jail.c @@ -113,7 +113,6 @@ l_getparams(lua_State *L) "expected a jail name (string) or id (integer)"); luaL_checktype(L, 2, LUA_TTABLE); params_count = 1 + lua_rawlen(L, 2); - luaL_argcheck(L, params_count > 1, 2, "expected #params > 0"); flags = luaL_optinteger(L, 3, 0); params = malloc(params_count * sizeof(struct jailparam)); @@ -236,7 +235,6 @@ l_setparams(lua_State *L) lua_pushnil(L); for (params_count = 1; lua_next(L, 2) != 0; ++params_count) lua_pop(L, 1); - luaL_argcheck(L, params_count > 1, 2, "expected #params > 0"); flags = luaL_optinteger(L, 3, 0);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202103022333.122NXi9w001477>