fix(wom+wob): reject path traversal in WOM texture paths + WOB material/group texPaths

Same defensive check as the WoB doodad path guard. Texture paths from
hostile WOM/WoB are passed to the asset manager; '..' or absolute paths
could probe outside the assets/ tree. Now cleared on detection — slot
survives but loads no texture (renderer falls back to white).

Single shared rejectTraversal lambda in WoB to avoid copy-paste.
This commit is contained in:
Kelsi 2026-05-06 06:16:54 -07:00
parent c4463ba96e
commit 719951976d
2 changed files with 19 additions and 0 deletions

View file

@ -113,6 +113,14 @@ WoweeModel WoweeModelLoader::load(const std::string& basePath) {
if (pathLen > 1024) { pathLen = 0; }
std::string path(pathLen, '\0');
f.read(path.data(), pathLen);
// Reject path-traversal — texture paths from a hostile WOM are fed
// to the asset manager and could probe files outside assets/.
if (path.find("..") != std::string::npos ||
(!path.empty() && (path[0] == '/' || path[0] == '\\')) ||
(path.size() >= 2 && path[1] == ':')) {
LOG_WARNING("WOM texture path rejected (traversal): ", path);
path.clear();
}
model.texturePaths.push_back(path);
}