diff --git a/include/Nazara/Core/VirtualDirectory.inl b/include/Nazara/Core/VirtualDirectory.inl index a4bdaa6b2..23e29fb83 100644 --- a/include/Nazara/Core/VirtualDirectory.inl +++ b/include/Nazara/Core/VirtualDirectory.inl @@ -214,6 +214,9 @@ namespace Nz if (!CreateOrRetrieveDirectory(path, dir, entryName)) throw std::runtime_error("invalid path"); + if (entryName == "." || entryName == "..") + throw std::runtime_error("invalid entry name"); + return dir->StoreInternal(std::string(entryName), DirectoryEntry{ std::move(directory) }); } @@ -226,6 +229,9 @@ namespace Nz if (!CreateOrRetrieveDirectory(path, dir, entryName)) throw std::runtime_error("invalid path"); + if (entryName == "." || entryName == "..") + throw std::runtime_error("invalid entry name"); + return dir->StoreInternal(std::string(entryName), PhysicalDirectoryEntry{ std::move(directoryPath) }); } @@ -238,6 +244,9 @@ namespace Nz if (!CreateOrRetrieveDirectory(path, dir, entryName)) throw std::runtime_error("invalid path"); + if (entryName == "." || entryName == "..") + throw std::runtime_error("invalid entry name"); + return dir->StoreInternal(std::string(entryName), FileContentEntry{ std::move(file) }); } @@ -250,6 +259,9 @@ namespace Nz if (!CreateOrRetrieveDirectory(path, dir, entryName)) throw std::runtime_error("invalid path"); + if (entryName == "." || entryName == "..") + throw std::runtime_error("invalid entry name"); + return dir->StoreInternal(std::string(entryName), PhysicalFileEntry{ std::move(filePath) }); } @@ -262,6 +274,9 @@ namespace Nz if (!CreateOrRetrieveDirectory(path, dir, entryName)) throw std::runtime_error("invalid path"); + if (entryName == "." || entryName == "..") + throw std::runtime_error("invalid entry name"); + return dir->StoreInternal(std::string(entryName), DataPointerEntry{ data, size }); }