DragonFlyBSD Kernel Audit
DF-0058 / 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
@@ -601,7 +601,8 @@
     for (i = 0; i < hdr->e_shnum; i++) {
 	if (shdr[i].sh_type == SHT_SYMTAB) {
 	    symtabindex = i;
-	    symstrindex = shdr[i].sh_link;
+	    if (shdr[i].sh_link < hdr->e_shnum)
+		symstrindex = shdr[i].sh_link;
 	}
     }
     if (symtabindex < 0 || symstrindex < 0)