Source-Changes-HG archive

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

[src/trunk]: src/sys/compat Make sure we have space for the aout header.



details:   https://anonhg.NetBSD.org/src/rev/64ccb93ba206
branches:  trunk
changeset: 811253:64ccb93ba206
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sun Oct 18 16:59:19 2015 +0000

description:
Make sure we have space for the aout header.

diffstat:

 sys/compat/linux/common/linux_exec_aout.c |  8 +++++---
 sys/compat/sunos/sunos_exec_aout.c        |  6 ++++--
 sys/compat/sunos32/sunos32_exec_aout.c    |  6 ++++--
 3 files changed, 13 insertions(+), 7 deletions(-)

diffs (86 lines):

diff -r ef2bdbdb1c0a -r 64ccb93ba206 sys/compat/linux/common/linux_exec_aout.c
--- a/sys/compat/linux/common/linux_exec_aout.c Sun Oct 18 15:58:23 2015 +0000
+++ b/sys/compat/linux/common/linux_exec_aout.c Sun Oct 18 16:59:19 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_exec_aout.c,v 1.67 2014/11/09 17:48:08 maxv Exp $        */
+/*     $NetBSD: linux_exec_aout.c,v 1.68 2015/10/18 16:59:19 maxv Exp $        */
 
 /*-
  * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_exec_aout.c,v 1.67 2014/11/09 17:48:08 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_exec_aout.c,v 1.68 2015/10/18 16:59:19 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_execfmt.h"
@@ -135,10 +135,12 @@
        int machtype, magic;
        int error = ENOEXEC;
 
+       if (epp->ep_hdrvalid < sizeof(struct exec))
+               return ENOEXEC;
+
        magic = LINUX_N_MAGIC(linux_ep);
        machtype = LINUX_N_MACHTYPE(linux_ep);
 
-
        if (machtype != LINUX_MID_MACHINE)
                return (ENOEXEC);
 
diff -r ef2bdbdb1c0a -r 64ccb93ba206 sys/compat/sunos/sunos_exec_aout.c
--- a/sys/compat/sunos/sunos_exec_aout.c        Sun Oct 18 15:58:23 2015 +0000
+++ b/sys/compat/sunos/sunos_exec_aout.c        Sun Oct 18 16:59:19 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sunos_exec_aout.c,v 1.18 2009/08/15 23:39:35 matt Exp $        */
+/*     $NetBSD: sunos_exec_aout.c,v 1.19 2015/10/18 16:59:19 maxv Exp $        */
 
 /*
  * Copyright (c) 1993 Theo de Raadt
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunos_exec_aout.c,v 1.18 2009/08/15 23:39:35 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunos_exec_aout.c,v 1.19 2015/10/18 16:59:19 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -71,6 +71,8 @@
        struct sunos_exec *sunmag = epp->ep_hdr;
        int error = ENOEXEC;
 
+       if (epp->ep_hdrvalid < sizeof(struct sunos_exec))
+               return ENOEXEC;
        if (!SUNOS_M_NATIVE(sunmag->a_machtype))
                return (ENOEXEC);
 
diff -r ef2bdbdb1c0a -r 64ccb93ba206 sys/compat/sunos32/sunos32_exec_aout.c
--- a/sys/compat/sunos32/sunos32_exec_aout.c    Sun Oct 18 15:58:23 2015 +0000
+++ b/sys/compat/sunos32/sunos32_exec_aout.c    Sun Oct 18 16:59:19 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sunos32_exec_aout.c,v 1.11 2008/05/29 14:51:26 mrg Exp $       */
+/*     $NetBSD: sunos32_exec_aout.c,v 1.12 2015/10/18 16:59:19 maxv Exp $      */
 
 /*
  * Copyright (c) 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunos32_exec_aout.c,v 1.11 2008/05/29 14:51:26 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunos32_exec_aout.c,v 1.12 2015/10/18 16:59:19 maxv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_execfmt.h"
@@ -54,6 +54,8 @@
        struct sunos_exec *sunmag = epp->ep_hdr;
        int error = ENOEXEC;
 
+       if (epp->ep_hdrvalid < sizeof(struct sunos_exec))
+               return ENOEXEC;
        if (!SUNOS_M_NATIVE(sunmag->a_machtype))
                return (ENOEXEC);
 



Home | Main Index | Thread Index | Old Index