diff options
Diffstat (limited to 'sys/kern/link_elf_obj.c')
-rw-r--r-- | sys/kern/link_elf_obj.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c index 1d27f73..31a6c79 100644 --- a/sys/kern/link_elf_obj.c +++ b/sys/kern/link_elf_obj.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 |