summaryrefslogtreecommitdiff
path: root/Kernel/Syscalls/execve.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-08-31 16:33:26 +0200
committerAndreas Kling <kling@serenityos.org>2021-08-31 16:46:16 +0200
commit5046a1fe38193ab7e47f91b5f068b86788f801f6 (patch)
tree547ed095e270f10ba526c791512f90ca7e0e5330 /Kernel/Syscalls/execve.cpp
parent0819f0a3fd6a99700d2b64f125295721b20fd203 (diff)
downloadserenity-5046a1fe38193ab7e47f91b5f068b86788f801f6.zip
Kernel: Ignore zero-sized PT_LOAD headers when loading ELF images
Diffstat (limited to 'Kernel/Syscalls/execve.cpp')
-rw-r--r--Kernel/Syscalls/execve.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/Kernel/Syscalls/execve.cpp b/Kernel/Syscalls/execve.cpp
index cf9eb5e329..4002e0d279 100644
--- a/Kernel/Syscalls/execve.cpp
+++ b/Kernel/Syscalls/execve.cpp
@@ -338,6 +338,9 @@ static KResultOr<LoadResult> load_elf_object(NonnullOwnPtr<Memory::AddressSpace>
if (program_header.type() != PT_LOAD)
return IterationDecision::Continue;
+ if (program_header.size_in_memory() == 0)
+ return IterationDecision::Continue;
+
if (program_header.is_writable()) {
// Writable section: create a copy in memory.
VERIFY(program_header.size_in_memory());