mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-07-15 12:24:43 +00:00
This should fix some problems on Linux/OSX, which uses absolute paths for mods. Thx Daxar.
This commit is contained in:
parent
b5d32906f7
commit
fceb1d1bcc
1 changed files with 5 additions and 2 deletions
|
@ -674,10 +674,13 @@ static void safePath(lua_State *L, const std::string& path)
|
||||||
if(path.length())
|
if(path.length())
|
||||||
{
|
{
|
||||||
if(path[0] == '/')
|
if(path[0] == '/')
|
||||||
|
{
|
||||||
|
if(!(dsq->mod.isActive() && path.substr(0, dsq->mod.getBaseModPath().length()) == dsq->mod.getBaseModPath())
|
||||||
{
|
{
|
||||||
lua_pushliteral(L, "Absolute paths are not allowed");
|
lua_pushliteral(L, "Absolute paths are not allowed");
|
||||||
lua_error(L);
|
lua_error(L);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(path.find("../") != std::string::npos)
|
if(path.find("../") != std::string::npos)
|
||||||
{
|
{
|
||||||
lua_pushliteral(L, "Accessing parent is not allowed");
|
lua_pushliteral(L, "Accessing parent is not allowed");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue