Skip to content

Commit 90e6551

Browse files
author
Mike Pall
committed
Limit path length passed to C library loader.
1 parent e296f56 commit 90e6551

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/lib_package.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,12 @@ static const char *mksymname(lua_State *L, const char *modname,
208208

209209
static int ll_loadfunc(lua_State *L, const char *path, const char *name, int r)
210210
{
211-
void **reg = ll_register(L, path);
211+
void **reg;
212+
if (strlen(path) >= 4096) {
213+
lua_pushliteral(L, "path too long");
214+
return PACKAGE_ERR_LIB;
215+
}
216+
reg = ll_register(L, path);
212217
if (*reg == NULL) *reg = ll_load(L, path, (*name == '*'));
213218
if (*reg == NULL) {
214219
return PACKAGE_ERR_LIB; /* Unable to load library. */

0 commit comments

Comments
 (0)