summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2002-09-08 02:17:44 +0000
committerpeter <peter@FreeBSD.org>2002-09-08 02:17:44 +0000
commit70e41e98b12b8d00f6c49509563ca2c5d28e1f95 (patch)
treedd0a4a65b85edcb7c86494e1c8b1969336dcdbfd /sys
parent21b23e4fe817edef196743750867fa0f6120c902 (diff)
downloadFreeBSD-src-70e41e98b12b8d00f6c49509563ca2c5d28e1f95.zip
FreeBSD-src-70e41e98b12b8d00f6c49509563ca2c5d28e1f95.tar.gz
Do not blow up when we walk off the end of the brands list.
Found by: kris, jake
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/imgact_elf.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c
index 66659fd..01e1bd2 100644
--- a/sys/kern/imgact_elf.c
+++ b/sys/kern/imgact_elf.c
@@ -188,6 +188,7 @@ __elfN(get_brandinfo)(const Elf_Ehdr *hdr, const char *interp)
static int
__elfN(check_header)(const Elf_Ehdr *hdr)
{
+ Elf_Brandinfo *bi;
int i;
if (!IS_ELF(*hdr) ||
@@ -201,7 +202,8 @@ __elfN(check_header)(const Elf_Ehdr *hdr)
*/
for (i = 0; i < MAX_BRANDS; i++) {
- if (elf_brand_list[i]->machine == hdr->e_machine)
+ bi = elf_brand_list[i];
+ if (bi != NULL && bi->machine == hdr->e_machine)
break;
}
if (i == MAX_BRANDS)
OpenPOWER on IntegriCloud