summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-02-06 14:12:20 +0100
committerAndreas Kling <kling@serenityos.org>2020-02-06 14:12:20 +0100
commitdc1885969564d0eadbe56efc4dc56fc657d92b8e (patch)
treece2d0895c1bd76ccdad003bb708ebef33c4a1561
parent1b866bbf42a46afff276f503c1f09844ef5d924a (diff)
downloadserenity-dc1885969564d0eadbe56efc4dc56fc657d92b8e.zip
Kernel: memset() all siginfo_t structs after creating them
-rw-r--r--Kernel/Process.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp
index 86d5749dd6..41162a3047 100644
--- a/Kernel/Process.cpp
+++ b/Kernel/Process.cpp
@@ -2269,6 +2269,7 @@ mode_t Process::sys$umask(mode_t mask)
siginfo_t Process::reap(Process& process)
{
siginfo_t siginfo;
+ memset(&siginfo, 0, sizeof(siginfo));
siginfo.si_signo = SIGCHLD;
siginfo.si_pid = process.pid();
siginfo.si_uid = process.uid();
@@ -2314,7 +2315,8 @@ KResultOr<siginfo_t> Process::do_waitid(idtype_t idtype, int id, int options)
// FIXME: Figure out what WNOHANG should do with stopped children.
if (idtype == P_ALL) {
InterruptDisabler disabler;
- siginfo_t siginfo = { 0 };
+ siginfo_t siginfo;
+ memset(&siginfo, 0, sizeof(siginfo));
for_each_child([&siginfo](Process& process) {
if (process.is_dead())
siginfo = reap(process);
@@ -2365,6 +2367,7 @@ KResultOr<siginfo_t> Process::do_waitid(idtype_t idtype, int id, int options)
return KResult(-ECHILD);
ASSERT(waitee_thread->state() == Thread::State::Stopped);
siginfo_t siginfo;
+ memset(&siginfo, 0, sizeof(siginfo));
siginfo.si_signo = SIGCHLD;
siginfo.si_pid = waitee_process->pid();
siginfo.si_uid = waitee_process->uid();