summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/compat/ibcs2/ibcs2_signal.c14
-rw-r--r--sys/compat/linux/linux_signal.c10
-rw-r--r--sys/compat/osf1/osf1_signal.c14
-rw-r--r--sys/compat/svr4/svr4_signal.c14
4 files changed, 39 insertions, 13 deletions
diff --git a/sys/compat/ibcs2/ibcs2_signal.c b/sys/compat/ibcs2/ibcs2_signal.c
index ddbb52b4fb6..1fcaf1412af 100644
--- a/sys/compat/ibcs2/ibcs2_signal.c
+++ b/sys/compat/ibcs2/ibcs2_signal.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ibcs2_signal.c,v 1.5 1997/09/15 03:01:44 deraadt Exp $ */
+/* $OpenBSD: ibcs2_signal.c,v 1.6 1998/12/22 07:58:44 deraadt Exp $ */
/* $NetBSD: ibcs2_signal.c,v 1.8 1996/05/03 17:05:27 christos Exp $ */
/*
@@ -209,6 +209,9 @@ ibcs2_sys_sigaction(p, v, retval)
caddr_t sg;
int error;
+ if (SCARG(uap, signum) < 0 || SCARG(uap, signum) >= IBCS2_NSIG)
+ return (EINVAL);
+
sg = stackgap_init(p->p_emul);
nisa = SCARG(uap, nsa);
oisa = SCARG(uap, osa);
@@ -256,16 +259,17 @@ ibcs2_sys_sigsys(p, v, retval)
syscallarg(int) sig;
syscallarg(ibcs2_sig_t) fp;
} */ *uap = v;
- int signum = ibcs2_to_bsd_sig[IBCS2_SIGNO(SCARG(uap, sig))];
- int error;
+ int signum, error;
caddr_t sg = stackgap_init(p->p_emul);
- if (signum <= 0 || signum >= IBCS2_NSIG) {
+ signum = IBCS2_SIGNO(SCARG(uap, sig));
+ if (signum < 0 || signum >= IBCS2_NSIG) {
if (IBCS2_SIGCALL(SCARG(uap, sig)) == IBCS2_SIGNAL_MASK ||
IBCS2_SIGCALL(SCARG(uap, sig)) == IBCS2_SIGSET_MASK)
*retval = (int)IBCS2_SIG_ERR;
return EINVAL;
}
+ signum = ibcs2_to_bsd_sig[signum];
switch (IBCS2_SIGCALL(SCARG(uap, sig))) {
/*
@@ -493,6 +497,8 @@ ibcs2_sys_kill(p, v, retval)
} */ *uap = v;
struct sys_kill_args ka;
+ if (SCARG(uap, signo) < 0 || SCARG(uap, signo) >= IBCS2_NSIG)
+ return (EINVAL);
SCARG(&ka, pid) = SCARG(uap, pid);
SCARG(&ka, signum) = ibcs2_to_bsd_sig[SCARG(uap, signo)];
return sys_kill(p, &ka, retval);
diff --git a/sys/compat/linux/linux_signal.c b/sys/compat/linux/linux_signal.c
index c08ca2a4188..a96699e96ff 100644
--- a/sys/compat/linux/linux_signal.c
+++ b/sys/compat/linux/linux_signal.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: linux_signal.c,v 1.3 1997/06/02 09:42:12 deraadt Exp $ */
+/* $OpenBSD: linux_signal.c,v 1.4 1998/12/22 07:58:45 deraadt Exp $ */
/* $NetBSD: linux_signal.c,v 1.10 1996/04/04 23:51:36 christos Exp $ */
/*
@@ -247,6 +247,9 @@ linux_sys_sigaction(p, v, retval)
caddr_t sg;
int error;
+ if (SCARG(uap, signum) < 0 || SCARG(uap, signum) >= LINUX_NSIG)
+ return (EINVAL);
+
sg = stackgap_init(p->p_emul);
nlsa = SCARG(uap, nsa);
olsa = SCARG(uap, osa);
@@ -305,6 +308,9 @@ linux_sys_signal(p, v, retval)
struct sigaction *osa, *nsa, tmpsa;
int error;
+ if (SCARG(uap, sig) < 0 || SCARG(uap, sig) >= LINUX_NSIG)
+ return (EINVAL);
+
sg = stackgap_init(p->p_emul);
nsa = stackgap_alloc(&sg, sizeof *nsa);
osa = stackgap_alloc(&sg, sizeof *osa);
@@ -505,6 +511,8 @@ linux_sys_kill(p, v, retval)
struct sys_kill_args ka;
SCARG(&ka, pid) = SCARG(uap, pid);
+ if (SCARG(uap, signum) < 0 || SCARG(uap, signum) >= LINUX_NSIG)
+ return (EINVAL);
SCARG(&ka, signum) = linux_to_bsd_sig[SCARG(uap, signum)];
return sys_kill(p, &ka, retval);
}
diff --git a/sys/compat/osf1/osf1_signal.c b/sys/compat/osf1/osf1_signal.c
index cd937c3de70..8b3fb0aacd2 100644
--- a/sys/compat/osf1/osf1_signal.c
+++ b/sys/compat/osf1/osf1_signal.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: osf1_signal.c,v 1.6 1998/02/17 01:48:07 millert Exp $ */
+/* $OpenBSD: osf1_signal.c,v 1.7 1998/12/22 07:58:45 deraadt Exp $ */
#include <sys/param.h>
#include <sys/systm.h>
@@ -239,6 +239,9 @@ osf1_sys_sigaction(p, v, retval)
caddr_t sg;
int error;
+ if (SCARG(uap, signum) < 0 || SCARG(uap, signum) >= OSF1_NSIG)
+ return (EINVAL);
+
sg = stackgap_init(p->p_emul);
nosa = SCARG(uap, nsa);
oosa = SCARG(uap, osa);
@@ -339,16 +342,17 @@ osf1_sys_signal(p, v, retval)
syscallarg(int) signum;
syscallarg(osf1_sig_t) handler;
} */ *uap = v;
- int signum = osf1_to_bsd_sig[OSF1_SIGNO(SCARG(uap, signum))];
- int error;
+ int signum, error;
caddr_t sg = stackgap_init(p->p_emul);
- if (signum <= 0 || signum >= OSF1_NSIG) {
+ int signum = OSF1_SIGNO(SCARG(uap, signum));
+ if (signum < 0 || signum >= OSF1_NSIG) {
if (OSF1_SIGCALL(SCARG(uap, signum)) == OSF1_SIGNAL_MASK ||
OSF1_SIGCALL(SCARG(uap, signum)) == OSF1_SIGDEFER_MASK)
*retval = (int)OSF1_SIG_ERR;
return EINVAL;
}
+ int signum = osf1_to_bsd_sig[signum];
switch (OSF1_SIGCALL(SCARG(uap, signum))) {
case OSF1_SIGDEFER_MASK:
@@ -560,6 +564,8 @@ osf1_sys_kill(p, v, retval)
} */ *uap = v;
struct sys_kill_args ka;
+ if (SCARG(uap, signum) < 0 || SCARG(uap, signum) >= OSF1_NSIG)
+ return (EINVAL);
SCARG(&ka, pid) = SCARG(uap, pid);
SCARG(&ka, signum) = osf1_to_bsd_sig[SCARG(uap, signum)];
return sys_kill(p, &ka, retval);
diff --git a/sys/compat/svr4/svr4_signal.c b/sys/compat/svr4/svr4_signal.c
index 4531aa74b62..285621567b6 100644
--- a/sys/compat/svr4/svr4_signal.c
+++ b/sys/compat/svr4/svr4_signal.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: svr4_signal.c,v 1.8 1997/09/15 06:04:58 millert Exp $ */
+/* $OpenBSD: svr4_signal.c,v 1.9 1998/12/22 07:58:46 deraadt Exp $ */
/* $NetBSD: svr4_signal.c,v 1.24 1996/12/06 03:21:53 christos Exp $ */
/*
@@ -282,6 +282,9 @@ svr4_sys_sigaction(p, v, retval)
caddr_t sg;
int error;
+ if (SCARG(uap, signum) < 0 || SCARG(uap, signum) >= SVR4_NSIG)
+ return (EINVAL);
+
sg = stackgap_init(p->p_emul);
nssa = SCARG(uap, nsa);
ossa = SCARG(uap, osa);
@@ -384,16 +387,17 @@ svr4_sys_signal(p, v, retval)
syscallarg(int) signum;
syscallarg(svr4_sig_t) handler;
} */ *uap = v;
- int signum = svr4_to_bsd_sig[SVR4_SIGNO(SCARG(uap, signum))];
- int error;
+ int signum, error;
caddr_t sg = stackgap_init(p->p_emul);
- if (signum <= 0 || signum >= SVR4_NSIG) {
+ signum = SVR4_SIGNO(SCARG(uap, signum));
+ if (signum < 0 || signum >= SVR4_NSIG) {
if (SVR4_SIGCALL(SCARG(uap, signum)) == SVR4_SIGNAL_MASK ||
SVR4_SIGCALL(SCARG(uap, signum)) == SVR4_SIGDEFER_MASK)
*retval = (int)SVR4_SIG_ERR;
return EINVAL;
}
+ signum = svr4_to_bsd_sig[signum];
switch (SVR4_SIGCALL(SCARG(uap, signum))) {
case SVR4_SIGDEFER_MASK:
@@ -619,6 +623,8 @@ svr4_sys_kill(p, v, retval)
} */ *uap = v;
struct sys_kill_args ka;
+ if (SCARG(uap, signum) < 0 || SCARG(uap, signum) >= SVR4_NSIG)
+ return (EINVAL);
SCARG(&ka, pid) = SCARG(uap, pid);
SCARG(&ka, signum) = svr4_to_bsd_sig[SCARG(uap, signum)];
return sys_kill(p, &ka, retval);