diff options
Diffstat (limited to 'libelf/elf32_getphdr.c')
| -rw-r--r-- | libelf/elf32_getphdr.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libelf/elf32_getphdr.c b/libelf/elf32_getphdr.c index c32c2827..0a617a67 100644 --- a/libelf/elf32_getphdr.c +++ b/libelf/elf32_getphdr.c @@ -1,5 +1,5 @@ /* Get ELF program header table. - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006 Red Hat, Inc. + Copyright (C) 1998-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper <[email protected]>, 1998. @@ -94,7 +94,9 @@ __elfw2(LIBELFBITS,getphdr_wrlock) (elf) ElfW2(LIBELFBITS,Ehdr) *ehdr = elf->state.ELFW(elf,LIBELFBITS).ehdr; /* If no program header exists return NULL. */ - size_t phnum = ehdr->e_phnum; + size_t phnum; + if (__elf_getphdrnum_rdlock (elf, &phnum) != 0) + goto out; if (phnum == 0) { __libelf_seterrno (ELF_E_NO_PHDR); |
