DragonFlyBSD Kernel Audit
DF-0057 / 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
@@ -588,7 +588,8 @@
 
     /* Try and load the symbol table if it's present.  (you can strip it!) */
     nbytes = hdr->e_shnum * hdr->e_shentsize;
-    if (nbytes == 0 || hdr->e_shoff == 0)
+    if (nbytes == 0 || hdr->e_shoff == 0 ||
+        hdr->e_shentsize != sizeof(Elf_Shdr))
 	goto nosyms;
     shdr = kmalloc(nbytes, M_LINKER, M_WAITOK | M_ZERO);
     error = vn_rdwr(UIO_READ, vp,