fix(libkernel): reject empty mkdir paths

This commit is contained in:
MarcZX100 2026-10-10 14:55:26 +00:00
parent 734fe53f82
commit 046680da48
2 changed files with 2 additions and 0 deletions

View File

@ -544,6 +544,7 @@ int APS5_VABI getdents_nid_postfix(int fd, char* buf, int nbytes) {
int APS5_VABI sceKernelMkdir(const char* path, uint16_t mode) {
(void)mode;
if (path == nullptr) throw std::invalid_argument("sceKernelMkdir: path is null");
if (!*path) return SceErrorFromErrno(GUEST_ENOENT);
auto native = ResolvePath_nid_no_patch(path);
while (!native.has_filename() && native.has_relative_path()) native = native.parent_path();
std::error_code error;

View File

@ -37,6 +37,7 @@ static bool Recorded(const char* guest) {
}
int main() {
std::filesystem::remove_all("kernel_sync_probe");
Require(sceKernelMkdir("", 0777) == static_cast<int>(0x80020002u));
Require(sceKernelMkdir("/", 0777) == static_cast<int>(0x80020011u));
Require(sceKernelMkdir("kernel_sync_probe", 0777) == 0);
Require(Recorded("kernel_sync_probe"));