Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-2-0]: src/sys/compat/ibcs2 Pullup rev 1.20 (requested by christos...



details:   https://anonhg.NetBSD.org/src/rev/baa7a5f45ecd
branches:  netbsd-2-0
changeset: 562791:baa7a5f45ecd
user:      jmc <jmc%NetBSD.org@localhost>
date:      Fri Nov 12 04:47:09 2004 +0000

description:
Pullup rev 1.20 (requested by christos in ticket #918)

Bounds check signal number.

diffstat:

 sys/compat/ibcs2/ibcs2_signal.c |  27 ++++++++++++++++++---------
 1 files changed, 18 insertions(+), 9 deletions(-)

diffs (73 lines):

diff -r 940db208a366 -r baa7a5f45ecd sys/compat/ibcs2/ibcs2_signal.c
--- a/sys/compat/ibcs2/ibcs2_signal.c   Fri Nov 12 04:45:57 2004 +0000
+++ b/sys/compat/ibcs2/ibcs2_signal.c   Fri Nov 12 04:47:09 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ibcs2_signal.c,v 1.19 2003/11/05 04:03:43 christos Exp $       */
+/*     $NetBSD: ibcs2_signal.c,v 1.19.2.1 2004/11/12 04:47:09 jmc Exp $        */
 
 /*
  * Copyright (c) 1995 Scott Bartram
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ibcs2_signal.c,v 1.19 2003/11/05 04:03:43 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ibcs2_signal.c,v 1.19.2.1 2004/11/12 04:47:09 jmc Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -190,7 +190,11 @@
        struct proc *p = l->l_proc;
        struct ibcs2_sigaction nisa, oisa;
        struct sigaction nbsa, obsa;
-       int error;
+       int error, signum = SCARG(uap, signum);
+
+       if (signum < 0 || signum >= IBCS2_NSIG)
+               return EINVAL;
+       signum = ibcs2_to_native_signo[signum];
 
        if (SCARG(uap, nsa)) {
                error = copyin(SCARG(uap, nsa), &nisa, sizeof(nisa));
@@ -198,7 +202,7 @@
                        return (error);
                ibcs2_to_native_sigaction(&nisa, &nbsa);
        }
-       error = sigaction1(p, ibcs2_to_native_signo[SCARG(uap, signum)],
+       error = sigaction1(p, signum,
            SCARG(uap, nsa) ? &nbsa : 0, SCARG(uap, osa) ? &obsa : 0,
            NULL, 0);
        if (error)
@@ -257,13 +261,13 @@
                syscallarg(ibcs2_sig_t) fp;
        } */ *uap = v;
        struct proc *p = l->l_proc;
-       int signum = ibcs2_to_native_signo[IBCS2_SIGNO(SCARG(uap, sig))];
        struct sigaction nbsa, obsa;
        sigset_t ss;
-       int error;
+       int error, signum = IBCS2_SIGNO(SCARG(uap, sig));
 
-       if (signum <= 0 || signum >= IBCS2_NSIG)
-               return (EINVAL);
+       if (signum < 0 || signum >= IBCS2_NSIG)
+               return EINVAL;
+       signum = ibcs2_to_native_signo[signum];
        
        switch (IBCS2_SIGCALL(SCARG(uap, sig))) {
        case IBCS2_SIGSET_MASK:
@@ -421,8 +425,13 @@
                syscallarg(int) signo;
        } */ *uap = v;
        struct sys_kill_args ka;
+       int signum = SCARG(uap, signo);
+
+       if (signum < 0 || signum >= IBCS2_NSIG)
+               return EINVAL;
+       signum = ibcs2_to_native_signo[signum];
 
        SCARG(&ka, pid) = SCARG(uap, pid);
-       SCARG(&ka, signum) = ibcs2_to_native_signo[SCARG(uap, signo)];
+       SCARG(&ka, signum) = signum;
        return sys_kill(l, &ka, retval);
 }



Home | Main Index | Thread Index | Old Index