diff options
author | peter <peter@FreeBSD.org> | 2002-09-08 02:17:44 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2002-09-08 02:17:44 +0000 |
commit | 70e41e98b12b8d00f6c49509563ca2c5d28e1f95 (patch) | |
tree | dd0a4a65b85edcb7c86494e1c8b1969336dcdbfd | |
parent | 21b23e4fe817edef196743750867fa0f6120c902 (diff) | |
download | FreeBSD-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
-rw-r--r-- | sys/kern/imgact_elf.c | 4 |
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) |