From 1d28e68aa29fd7b996c52e20268a480f16ebcb3d Mon Sep 17 00:00:00 2001 From: Matheus Date: Wed, 26 Oct 2022 21:43:46 -0300 Subject: [PATCH] syscalls: waitpid: fix possible null pointer dereference --- src/sys/syscalls/waitpid.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sys/syscalls/waitpid.c b/src/sys/syscalls/waitpid.c index 228e0648..559063c1 100644 --- a/src/sys/syscalls/waitpid.c +++ b/src/sys/syscalls/waitpid.c @@ -92,8 +92,9 @@ syscallret syscall_waitpid(pid_t pid, int *status, int options){ else{ proc->child = child->sibling; } - - *status = child->status; // XXX safer way of doing this + + if(status) + *status = child->status; // XXX safer way of doing this // the pointer to the last remaining thread is is proc->threads