]> git.ipfire.org Git - thirdparty/elfutils.git/commit
libelf: If e_phnum is zero then set e_phoff also to zero.
authorMark Wielaard <mjw@redhat.com>
Wed, 13 May 2015 13:21:57 +0000 (15:21 +0200)
committerMark Wielaard <mjw@redhat.com>
Mon, 18 May 2015 13:48:04 +0000 (15:48 +0200)
commitc2297eab17b7dbb98021b51f063f71d1cdc7893a
treef3bc8cc95e7f807f6d38baed35b0e4b7f8009da1
parent6d93c8c46d9b2b381c889e5f176451996845b055
libelf: If e_phnum is zero then set e_phoff also to zero.

If phnum is zero make sure e_phoff is also zero and not some random value.
That would cause trouble in update_file. This could happen when ELF_F_LAYOUT
is set and the user copied over a ehdr from a bogus ELF file where the phdrs
are unreadable. In that case trying to write out the new ELF image would
crash trying to follow the bogus e_phdr value.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
libelf/ChangeLog
libelf/elf32_updatenull.c