Make sure we have space for the aout header.

This commit is contained in:
maxv 2015-10-18 16:59:19 +00:00
parent 054ca2c181
commit 6ad8aacf8e
3 changed files with 13 additions and 7 deletions

View File

@ -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 @@ exec_linux_aout_makecmds(struct lwp *l, struct exec_package *epp)
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);

View File

@ -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 @@ exec_sunos_aout_makecmds(struct lwp *l, struct exec_package *epp)
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);

View File

@ -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 @@ exec_sunos32_aout_makecmds(struct lwp *l, struct exec_package *epp)
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);