From 86927e2df644711a6fb61cc572d7c65dd7e38b82 Mon Sep 17 00:00:00 2001 From: Nadav Har'El <nyh@cloudius-systems.com> Date: Tue, 11 Mar 2014 18:42:00 +0200 Subject: [PATCH] sigaction() error checking Add signal number verification to sigaction(). Also add a FIXME comment that we don't support mode sa_flags. Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com> Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com> --- libc/signal.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libc/signal.cc b/libc/signal.cc index 5be5c4b8e..18f5f6e7e 100644 --- a/libc/signal.cc +++ b/libc/signal.cc @@ -135,6 +135,11 @@ int sigprocmask(int how, const sigset_t* _set, sigset_t* _oldset) int sigaction(int signum, const struct sigaction* act, struct sigaction* oldact) { + // FIXME: We do not support any sa_flags besides SA_SIGINFO. + if (signum < 0 || signum >= (int)nsignals) { + errno = EINVAL; + return -1; + } if (oldact) { *oldact = signal_actions[signum]; } -- GitLab