summaryrefslogtreecommitdiff
path: root/Kernel/Process.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-01-18 11:43:28 +0100
committerAndreas Kling <kling@serenityos.org>2020-01-18 11:43:28 +0100
commitaa63de53bd8b3f2f4047347834c6c814f12cd31a (patch)
treef1ddc0acb00169f099144ef95a3580be5616f30b /Kernel/Process.cpp
parent545e2ba065b7619f4ebfcdd9a0c6ed378c43eb1b (diff)
downloadserenity-aa63de53bd8b3f2f4047347834c6c814f12cd31a.zip
Kernel: Use get_syscall_path_argument() in sys$execve()
Paths passed to sys$execve() should certainly be subject to all the usual path validation checks.
Diffstat (limited to 'Kernel/Process.cpp')
-rw-r--r--Kernel/Process.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp
index 114bd35c86..1dd119ecf5 100644
--- a/Kernel/Process.cpp
+++ b/Kernel/Process.cpp
@@ -1114,12 +1114,13 @@ int Process::sys$execve(const Syscall::SC_execve_params* user_params)
if (params.arguments.length > ARG_MAX || params.environment.length > ARG_MAX)
return -E2BIG;
- auto path = validate_and_copy_string_from_user(params.path);
- if (path.is_null())
- return -EFAULT;
-
- if (path.is_empty())
- return -ENOENT;
+ String path;
+ {
+ auto path_arg = get_syscall_path_argument(params.path);
+ if (path_arg.is_error())
+ return path_arg.error();
+ path = path_arg.value();
+ }
auto copy_user_strings = [&](const auto& list, auto& output) {
if (!list.length)