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_updatenull.c | |
| parent | 7452e1953a4a4e70af3fb472e609e89776031e53 (diff) | |
Add elf_getphdrnum, support >65536 phdrs.
Diffstat (limited to 'libelf/elf32_updatenull.c')
| -rw-r--r-- | libelf/elf32_updatenull.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/libelf/elf32_updatenull.c b/libelf/elf32_updatenull.c index 5ce8bbc9..ca9a8708 100644 --- a/libelf/elf32_updatenull.c +++ b/libelf/elf32_updatenull.c @@ -1,5 +1,5 @@ /* Update data structures for changes. - Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 Red Hat, Inc. + Copyright (C) 2000-2010 Red Hat, Inc. This file is part of Red Hat elfutils. Written by Ulrich Drepper <[email protected]>, 2000. @@ -164,13 +164,17 @@ __elfw2(LIBELFBITS,updatenull_wrlock) (Elf *elf, int *change_bop, size_t shnum) return -1; } + size_t phnum; + if (unlikely (__elf_getphdrnum_rdlock (elf, &phnum) != 0)) + return -1; + if (elf->flags & ELF_F_LAYOUT) { /* The user is supposed to fill out e_phoff. Use it and e_phnum to determine the maximum extend. */ size = MAX ((size_t) size, ehdr->e_phoff - + elf_typesize (LIBELFBITS, ELF_T_PHDR, ehdr->e_phnum)); + + elf_typesize (LIBELFBITS, ELF_T_PHDR, phnum)); } else { @@ -179,7 +183,7 @@ __elfw2(LIBELFBITS,updatenull_wrlock) (Elf *elf, int *change_bop, size_t shnum) ehdr_flags); /* We need no alignment here. */ - size += elf_typesize (LIBELFBITS, ELF_T_PHDR, ehdr->e_phnum); + size += elf_typesize (LIBELFBITS, ELF_T_PHDR, phnum); } } |
