mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
Limit path length passed to C library loader.
This commit is contained in:
parent
e296f56b82
commit
90e65514dd
@ -208,7 +208,12 @@ static const char *mksymname(lua_State *L, const char *modname,
|
|||||||
|
|
||||||
static int ll_loadfunc(lua_State *L, const char *path, const char *name, int r)
|
static int ll_loadfunc(lua_State *L, const char *path, const char *name, int r)
|
||||||
{
|
{
|
||||||
void **reg = ll_register(L, path);
|
void **reg;
|
||||||
|
if (strlen(path) >= 4096) {
|
||||||
|
lua_pushliteral(L, "path too long");
|
||||||
|
return PACKAGE_ERR_LIB;
|
||||||
|
}
|
||||||
|
reg = ll_register(L, path);
|
||||||
if (*reg == NULL) *reg = ll_load(L, path, (*name == '*'));
|
if (*reg == NULL) *reg = ll_load(L, path, (*name == '*'));
|
||||||
if (*reg == NULL) {
|
if (*reg == NULL) {
|
||||||
return PACKAGE_ERR_LIB; /* Unable to load library. */
|
return PACKAGE_ERR_LIB; /* Unable to load library. */
|
||||||
|
Loading…
Reference in New Issue
Block a user