1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-30 15:08:12 +00:00

Kernel: Fix wrong sizeof() type in sys$execve() argument overflow check

This commit is contained in:
Andreas Kling 2021-02-14 00:14:17 +01:00
parent 34a83aba71
commit ffdfbf1dba

View file

@ -885,13 +885,13 @@ int Process::sys$execve(Userspace<const Syscall::SC_execve_params*> user_params)
auto copy_user_strings = [](const auto& list, auto& output) {
if (!list.length)
return true;
Checked size = sizeof(list.strings);
Checked size = sizeof(*list.strings);
size *= list.length;
if (size.has_overflow())
return false;
Vector<Syscall::StringArgument, 32> strings;
strings.resize(list.length);
if (!copy_from_user(strings.data(), list.strings, list.length * sizeof(Syscall::StringArgument)))
if (!copy_from_user(strings.data(), list.strings, list.length * sizeof(*list.strings)))
return false;
for (size_t i = 0; i < list.length; ++i) {
auto string = copy_string_from_user(strings[i]);