mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-22 08:33:12 -05:00
fix(libkernel_sys): reject parent-directory components in symlink targets
symlink_nid_postfix blocked absolute targets but accepted relative
targets containing '..' unchecked. The target is stored verbatim and the
host OS follows it when the link is later opened through the guest path
resolver, so symlink("../../../../..", "e") followed by
sceKernelOpen("e/etc/passwd", ...) reads host files outside the guest
root. Reject any '..' component, mirroring the absolute-target handling
above it.
This commit is contained in:
1 parent
2d7619cf99
commit
7408e55478
1 file changed
+6
@@ -375,6 +375,12 @@ int APS5_VABI symlink_nid_postfix(const char* target, const char* created) {
|
||||
NotImplemented_nid_no_patch("symlink: absolute targets");
|
||||
return -1;
|
||||
}
|
||||
for (const auto& part : std::filesystem::path(target)) {
|
||||
if (part == "..") {
|
||||
NotImplemented_nid_no_patch("symlink: parent-directory targets");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
std::filesystem::path native;
|
||||
if (const int error = ResolvePathError_nid_no_patch(created, native)) return static_cast<int>(Fail(error));
|
||||
std::error_code error;
|
||||
|
||||
Reference in new issue
Block a user