From ffdfbf1dba611b2675460954bcf80bcc20500a94 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 14 Feb 2021 00:14:17 +0100 Subject: [PATCH] Kernel: Fix wrong sizeof() type in sys$execve() argument overflow check --- Kernel/Syscalls/execve.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Kernel/Syscalls/execve.cpp b/Kernel/Syscalls/execve.cpp index 61a0ffd11a..f4575f8f6a 100644 --- a/Kernel/Syscalls/execve.cpp +++ b/Kernel/Syscalls/execve.cpp @@ -885,13 +885,13 @@ int Process::sys$execve(Userspace 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 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]);