DragonFlyBSD Kernel Audit
DF-0059 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c
--- a/sys/kern/link_elf.c
+++ b/sys/kern/link_elf.c
@@ -533,6 +533,11 @@
 	error = ENOEXEC;
 	goto out;
     }
+    if (nsegs != 2) {
+	link_elf_error("Object does not have exactly two PT_LOAD segments");
+	error = ENOEXEC;
+	goto out;
+    }
 
     /*
      * Allocate the entire address space of the object, to stake out our