mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:17:44 +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:
parent
ed90d39cd7
commit
0f5221568b
1 changed files with 4 additions and 0 deletions
|
@ -1159,6 +1159,10 @@ int Process::sys$execve(const Syscall::SC_execve_params* user_params)
|
||||||
strings.resize(list.length);
|
strings.resize(list.length);
|
||||||
copy_from_user(strings.data(), list.strings, list.length * sizeof(Syscall::StringArgument));
|
copy_from_user(strings.data(), list.strings, list.length * sizeof(Syscall::StringArgument));
|
||||||
for (size_t i = 0; i < list.length; ++i) {
|
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))
|
if (!validate_read(strings[i].characters, strings[i].length))
|
||||||
return false;
|
return false;
|
||||||
output.append(copy_string_from_user(strings[i].characters, strings[i].length));
|
output.append(copy_string_from_user(strings[i].characters, strings[i].length));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue