aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/link_elf.c
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>2003-05-12 15:08:10 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>2003-05-12 15:08:10 +0000
commit87b1831f1d285e870733115a47e4fb2e11331aac (patch)
treeef5a6109587e8893073d934222b11960e64d8313 /sys/kern/link_elf.c
parent1964fb9ba2af97bae24cd66539da5057a007fdee (diff)
downloadsrc-87b1831f1d285e870733115a47e4fb2e11331aac.tar.gz
src-87b1831f1d285e870733115a47e4fb2e11331aac.zip
Bail out if there were not two loadable sections. Add XXX comment about
one other issue. Approved by: re/rwatson.
Notes
Notes: svn path=/head/; revision=114946
Diffstat (limited to 'sys/kern/link_elf.c')
-rw-r--r--sys/kern/link_elf.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c
index 1d27f735294d..31a6c79f00fa 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