1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:38:11 +00:00

Kernel: sys$execve() should not EFAULT for empty argument strings

It's okay to exec { "/bin/echo", "" } and it should not EFAULT.
This commit is contained in:
Andreas Kling 2020-01-25 12:20:29 +01:00
parent ed90d39cd7
commit 0f5221568b

View file

@ -1159,6 +1159,10 @@ int Process::sys$execve(const Syscall::SC_execve_params* user_params)
strings.resize(list.length);
copy_from_user(strings.data(), list.strings, list.length * sizeof(Syscall::StringArgument));
for (size_t i = 0; i < list.length; ++i) {
if (strings[i].length == 0) {
output.append(String::empty());
continue;
}
if (!validate_read(strings[i].characters, strings[i].length))
return false;
output.append(copy_string_from_user(strings[i].characters, strings[i].length));