Core/PlayerDump: Add config to disallow overwriting existing files and usage of paths in player dump write to prevent local exploits
This commit is contained in:
@@ -352,6 +352,15 @@ bool PlayerDumpWriter::GetDump(uint32 guid, std::string &dump)
|
||||
|
||||
DumpReturn PlayerDumpWriter::WriteDump(const std::string& file, uint32 guid)
|
||||
{
|
||||
if (sWorld->getBoolConfig(CONFIG_PDUMP_NO_PATHS))
|
||||
if (strstr(file.c_str(), "\\") || strstr(file.c_str(), "/"))
|
||||
return DUMP_FILE_OPEN_ERROR;
|
||||
if (sWorld->getBoolConfig(CONFIG_PDUMP_NO_OVERWRITE))
|
||||
if (FILE* f = fopen(file.c_str(), "r"))
|
||||
{
|
||||
fclose(f);
|
||||
return DUMP_FILE_OPEN_ERROR;
|
||||
}
|
||||
FILE* fout = fopen(file.c_str(), "w");
|
||||
if (!fout)
|
||||
return DUMP_FILE_OPEN_ERROR;
|
||||
|
||||
Reference in New Issue
Block a user