Found by coverity issue 887. Check for NULL before using base_ph so

an interpreter that does not have PT_LOAD in the program header doesn't
crash the system.
This commit is contained in:
erh 2006-03-17 08:51:35 +00:00
parent 63c0159af3
commit 8e641f354a

View File

@ -1,4 +1,4 @@
/* $NetBSD: exec_elf32.c,v 1.109 2006/02/04 12:09:50 yamt Exp $ */
/* $NetBSD: exec_elf32.c,v 1.110 2006/03/17 08:51:35 erh Exp $ */
/*-
* Copyright (c) 1994, 2000, 2005 The NetBSD Foundation, Inc.
@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(1, "$NetBSD: exec_elf32.c,v 1.109 2006/02/04 12:09:50 yamt Exp $");
__KERNEL_RCSID(1, "$NetBSD: exec_elf32.c,v 1.110 2006/03/17 08:51:35 erh Exp $");
/* If not included by exec_elf64.c, ELFSIZE won't be defined. */
#ifndef ELFSIZE
@ -444,6 +444,12 @@ elf_load_file(struct lwp *l, struct exec_package *epp, char *path,
}
}
if (base_ph == NULL)
{
error = ENOEXEC;
goto bad;
}
/*
* Now compute the size and load address.
*/