Merge pull request #3428 from MarcZX100/codex/fix-libkernel-open-empty-path-3308
fix(libkernel): reject empty sceKernelOpen paths
This commit is contained in:
commit
c253de1165
|
|
@ -135,6 +135,7 @@ static int SceIoErrorFromErrno(int error) {
|
|||
extern "C" {
|
||||
|
||||
int APS5_VABI sceKernelOpen(const char* path, int flags, std::uint16_t mode) {
|
||||
if (path != nullptr && *path == '\0') return SCE_KERNEL_ERROR_ENOENT;
|
||||
APS5_LOG_OUT("path=%s flags=0x%X nativeFlags=0x%X mode=0%o", path, flags, MapFlags(flags), mode);
|
||||
if (path != nullptr && File::IsRandomDevicePath(path)) {
|
||||
if ((flags & SCE_KERNEL_O_ACCMODE) != SCE_KERNEL_O_RDONLY) throw std::runtime_error(std::string(__func__) + ": writing to " + path + " is not implemented");
|
||||
|
|
|
|||
|
|
@ -440,6 +440,7 @@ int main() {
|
|||
Require(sceKernelOpen(missingName.c_str(), 0x20000, 0) == static_cast<int>(0x80020002u));
|
||||
Require(open_nid_postfix("", 0, 0) == -1 && *__error_nid_postfix() == 2);
|
||||
Require(_open_nid_postfix("", 0) == -1 && *__error_nid_postfix() == 2);
|
||||
Require(sceKernelOpen("", 0, 0) == static_cast<int>(0x80020002u));
|
||||
Require(open_nid_postfix(nullptr, 0, 0) == -1 && *__error_nid_postfix() == 14);
|
||||
Require(_open_nid_postfix(nullptr, 0) == -1 && *__error_nid_postfix() == 14);
|
||||
Require(rmdir_nid_postfix(rootName.c_str()) == -1 && *__error_nid_postfix() == 66);
|
||||
|
|
|
|||
Loading…
Reference in New Issue