std: Fix typo in ELF section header iterator

The code accidentally used the phdr offset instead of the shdr one while
iterating over the section headers.

Fixes #6338
This commit is contained in:
LemonBoy
2020-09-15 13:13:42 +02:00
committed by Veikka Tuominen
parent 5e39ab4600
commit c1c3212500

View File

@@ -471,7 +471,7 @@ pub const SectionHeaderIterator = struct {
if (self.elf_header.is_64) {
var shdr: Elf64_Shdr = undefined;
const offset = self.elf_header.phoff + @sizeOf(@TypeOf(shdr)) * self.index;
const offset = self.elf_header.shoff + @sizeOf(@TypeOf(shdr)) * self.index;
try preadNoEof(self.file, mem.asBytes(&shdr), offset);
// ELF endianness matches native endianness.