diff options
author | phk <phk@FreeBSD.org> | 2003-05-12 15:08:10 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2003-05-12 15:08:10 +0000 |
commit | d38d01f72d0d30cfe5efd8d9d03b218e03ba7d3e (patch) | |
tree | ef5a6109587e8893073d934222b11960e64d8313 /sys/kern/link_elf.c | |
parent | c21d149f29c38c8ba5f7b5a459b8087f179b6e0c (diff) | |
download | FreeBSD-src-d38d01f72d0d30cfe5efd8d9d03b218e03ba7d3e.zip FreeBSD-src-d38d01f72d0d30cfe5efd8d9d03b218e03ba7d3e.tar.gz |
Bail out if there were not two loadable sections. Add XXX comment about
one other issue.
Approved by: re/rwatson.
Diffstat (limited to 'sys/kern/link_elf.c')
-rw-r--r-- | sys/kern/link_elf.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c index 1d27f73..31a6c79 100644 --- a/sys/kern/link_elf.c +++ b/sys/kern/link_elf.c @@ -646,6 +646,9 @@ link_elf_load_file(linker_class_t cls, const char* filename, error = ENOEXEC; goto out; } + /* + * XXX: We just trust they come in right order ?? + */ segs[nsegs] = phdr; ++nsegs; break; @@ -671,6 +674,11 @@ link_elf_load_file(linker_class_t cls, const char* filename, error = ENOEXEC; goto out; } + if (nsegs != 2) { + link_elf_error("Too few sections"); + error = ENOEXEC; + goto out; + } /* * Allocate the entire address space of the object, to stake out our |