diff options
Diffstat (limited to 'Kernel/Syscalls/chdir.cpp')
-rw-r--r-- | Kernel/Syscalls/chdir.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Kernel/Syscalls/chdir.cpp b/Kernel/Syscalls/chdir.cpp index 68437ab0a9..46cf3a2459 100644 --- a/Kernel/Syscalls/chdir.cpp +++ b/Kernel/Syscalls/chdir.cpp @@ -66,12 +66,11 @@ int Process::sys$getcwd(Userspace<char*> buffer, ssize_t size) REQUIRE_PROMISE(rpath); if (size < 0) return -EINVAL; - if (!validate_write(buffer, size)) - return -EFAULT; auto path = current_directory().absolute_path(); if ((size_t)size < path.length() + 1) return -ERANGE; - copy_to_user(buffer, path.characters(), path.length() + 1); + if (!copy_to_user(buffer, path.characters(), path.length() + 1)) + return -EFAULT; return 0; } |