Module Name: src Committed By: uwe Date: Mon Apr 17 18:06:30 UTC 2017
Modified Files: src/sys/lib/libsa: loadfile_elf32.c Log Message: Section at index 0 is SHN_UNDEF. When searching for symbol sections skip it and start with index 1. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/lib/libsa/loadfile_elf32.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/lib/libsa/loadfile_elf32.c diff -u src/sys/lib/libsa/loadfile_elf32.c:1.37 src/sys/lib/libsa/loadfile_elf32.c:1.38 --- src/sys/lib/libsa/loadfile_elf32.c:1.37 Mon Apr 17 17:44:48 2017 +++ src/sys/lib/libsa/loadfile_elf32.c Mon Apr 17 18:06:30 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: loadfile_elf32.c,v 1.37 2017/04/17 17:44:48 uwe Exp $ */ +/* $NetBSD: loadfile_elf32.c,v 1.38 2017/04/17 18:06:30 uwe Exp $ */ /* * Copyright (c) 1997, 2008 The NetBSD Foundation, Inc. @@ -432,7 +432,7 @@ ELFNAMEEND(loadfile)(int fd, Elf_Ehdr *e /* * First load the section names section. */ - if (boot_load_ctf && (elf->e_shstrndx != 0)) { + if (boot_load_ctf && (elf->e_shstrndx != SHN_UNDEF)) { Elf_Off shstroff = shp[elf->e_shstrndx].sh_offset; shstrsz = shp[elf->e_shstrndx].sh_size; if (flags & LOAD_SYM) { @@ -473,7 +473,7 @@ ELFNAMEEND(loadfile)(int fd, Elf_Ehdr *e * table. */ first = 1; - for (i = 0; i < elf->e_shnum; i++) { + for (i = 1; i < elf->e_shnum; i++) { if (i == elf->e_shstrndx) { /* already loaded this section */ continue; @@ -492,7 +492,7 @@ ELFNAMEEND(loadfile)(int fd, Elf_Ehdr *e shp[i].sh_offset = 0; break; case SHT_STRTAB: - for (j = 0; j < elf->e_shnum; j++) + for (j = 1; j < elf->e_shnum; j++) if (shp[j].sh_type == SHT_SYMTAB && shp[j].sh_link == (unsigned int)i) goto havesym;