mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-07 09:33:51 +00:00
fix(wcp): skip out-of-tree files at pack time
fs::relative can return '../foo' when the pack source is a symlink that resolves outside the pack root. The unpacker rejects '..' or absolute paths wholesale, so a single rogue symlink would ruin the whole archive. Skip the offending file at pack with a warning so the rest of the zone still ships.
This commit is contained in:
parent
2f56941ad2
commit
6b82196b7d
1 changed files with 8 additions and 0 deletions
|
|
@ -46,6 +46,14 @@ bool ContentPacker::packZone(const std::string& outputDir, const std::string& ma
|
|||
}
|
||||
std::string rel = fs::relative(entry.path(), srcDir).string();
|
||||
std::replace(rel.begin(), rel.end(), '\\', '/');
|
||||
// fs::relative can return "../foo" when srcDir is a symlink that
|
||||
// resolves outside the pack root; reject those before they're
|
||||
// baked into a WCP that the unpacker will then refuse wholesale.
|
||||
if (rel.find("..") != std::string::npos ||
|
||||
(!rel.empty() && rel[0] == '/')) {
|
||||
LOG_WARNING("WCP skipping out-of-tree file: ", entry.path().string());
|
||||
continue;
|
||||
}
|
||||
files.push_back({rel, entry.path().string()});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue