diff options
| author | Roland McGrath <[email protected]> | 2010-01-07 19:41:04 -0800 |
|---|---|---|
| committer | Roland McGrath <[email protected]> | 2010-01-07 19:43:42 -0800 |
| commit | 6fd3cd104adf4107aa64e1c1e84028b4ea0b3296 (patch) | |
| tree | 6d42f1017e802ccf94abbe5af598eec8b2600166 /libelf/elf32_getphdr.c | |
| parent | 7452e1953a4a4e70af3fb472e609e89776031e53 (diff) | |
Add elf_getphdrnum, support >65536 phdrs.
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); |
