Fix secure io.lines

It used to drop all of the return values from the
insecure version of the function.
This commit is contained in:
ShadowNinja 2016-11-24 10:10:20 -05:00
parent 9e10f9f49a
commit 3af5eef964
1 changed files with 2 additions and 2 deletions

View File

@ -577,13 +577,13 @@ int ScriptApiSecurity::sl_io_lines(lua_State *L)
CHECK_SECURE_PATH(L, path); CHECK_SECURE_PATH(L, path);
} }
int top_precall = lua_gettop(L);
push_original(L, "io", "lines"); push_original(L, "io", "lines");
lua_pushvalue(L, 1); lua_pushvalue(L, 1);
int top_precall = lua_gettop(L);
lua_call(L, 1, LUA_MULTRET); lua_call(L, 1, LUA_MULTRET);
// Return number of arguments returned by the function, // Return number of arguments returned by the function,
// adjusting for the function being poped. // adjusting for the function being poped.
return lua_gettop(L) - (top_precall - 1); return lua_gettop(L) - top_precall;
} }