summaryrefslogtreecommitdiffstats
path: root/libelf/elf32_updatenull.c
diff options
context:
space:
mode:
authorUlrich Drepper <[email protected]>2006-12-18 22:38:08 +0000
committerUlrich Drepper <[email protected]>2006-12-18 22:38:08 +0000
commit56bc0b83ea81b7e959aaa4e1d01f8b36f2804a52 (patch)
treebc88f45df09a0819c43122d8101500c51874c1c2 /libelf/elf32_updatenull.c
parent8190db6a86a37aec86c81626ab1b083c96aff891 (diff)
Lock down libelf and elflint a bit more after import of Roland's changes.
Diffstat (limited to 'libelf/elf32_updatenull.c')
-rw-r--r--libelf/elf32_updatenull.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/libelf/elf32_updatenull.c b/libelf/elf32_updatenull.c
index 0de48bea..b3299fe4 100644
--- a/libelf/elf32_updatenull.c
+++ b/libelf/elf32_updatenull.c
@@ -147,13 +147,16 @@ __elfw2(LIBELFBITS,updatenull) (Elf *elf, int *change_bop, size_t shnum)
off_t size = elf_typesize (LIBELFBITS, ELF_T_EHDR, 1);
/* Set the program header position. */
- if (elf->state.ELFW(elf,LIBELFBITS).phdr == NULL && ehdr->e_phnum != 0)
+ if (elf->state.ELFW(elf,LIBELFBITS).phdr == NULL
+ && (ehdr->e_type == ET_EXEC || ehdr->e_type == ET_DYN
+ || ehdr->e_type == ET_CORE))
(void) INTUSE(elfw2(LIBELFBITS,getphdr)) (elf);
if (elf->state.ELFW(elf,LIBELFBITS).phdr != NULL)
{
- /* Only executables or shared objects have a program header. */
- if (unlikely (ehdr->e_type == ET_REL)
- && (elf->flags & ELF_F_PERMISSIVE) == 0)
+ /* Only executables, shared objects, and core files have a program
+ header. */
+ if (ehdr->e_type != ET_EXEC && ehdr->e_type != ET_DYN
+ && unlikely (ehdr->e_type != ET_CORE))
{
__libelf_seterrno (ELF_E_INVALID_PHDR);
return -1;